How can I dial GPRS/EDGE in Win CE
Posted
by brontes
on Stack Overflow
See other posts from Stack Overflow
or by brontes
Published on 2010-06-10T21:18:29Z
Indexed on
2010/06/10
21:23 UTC
Read the original article
Hit count: 208
Hello all.
I am developing application in python on Windows CE which needs connection to the internet (via GPRS/EDGE). When I turn on the device, the internet connection is not active. It becomes active if I open internet explorer.
I would like to activate connection in my application. I'm trying to do this with RasDial function over ctypes library, but I can't get it to work. Is this the right way or I should do something else?
Below is my current code. The ResDial function keeps returning error 87 – Invalid parameter. I don't know anymore what is wrong with it.
I would really appreciate any kind of help. Thanks in advance.
encoding: utf-8
import ppygui as gui from ctypes import * import os
class MainFrame(gui.CeFrame): def init(self, parent = None): gui.CeFrame.init(self, title=u"Zgodovina dokumentov", menu="Menu")
DWORD = c_ulong
TCHAR = c_wchar
ULONG_PTR = c_ulong
class RASDIALPARAMS(Structure):
_fields_ = [("dwSize", DWORD),
("szEntryName", TCHAR*21),
("szPhoneNumber", TCHAR*129),
("szCallbackNumber", TCHAR*49),
("szUserName", TCHAR*257),
("szPassword", TCHAR*257),
("szDomain", TCHAR*16),
]
try:
param = RASDIALPARAMS()
param.dwSize = 1462 # also tried 1464 and sizeof(RASDIALPARAMS()). Makes no difference.
param.szEntryName = u"My Connection"
param.szPhoneNumber = u"0"
param.szCallbackNumber = u"0"
param.szUserName = u"0"
param.szPassword = u"0"
param.szDomain = u"0"
iNasConn = c_ulong(0)
ras = windll.coredll.RasDial(None, None, param, c_ulong(0xFFFFFFFF), c_voidp(self._w32_hWnd), byref(iNasConn))
print ras, repr(iNasConn) #this prints 87 c_ulong(0L)
except Exception, e:
print "Error"
print e
if name == 'main': app = gui.Application(MainFrame(None)) # create an application bound to our main frame instance app.run() #launch the app !
© Stack Overflow or respective owner