How can I dial GPRS/EDGE in Win CE?

Discussion in 'Software' started by Brontes, Jun 10, 2010.

  1. Brontes

    Brontes

    Joined:
    Jun 10, 2010
    Messages:
    1
    Likes Received:
    0
    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 !
     
    Brontes, Jun 10, 2010
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.