PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Cant create a network data connection with windev Mobile
Cant create a network data connection with windev Mobile
Débuté par Mel, 02 fév. 2009 09:48 - 4 réponses
Posté le 02 février 2009 - 09:48
Hi All
I’m new to windev mobile having switched from Clarion to do a mobile project.
I’m having trouble forcing a mobile device to create an active GPRS data connection (my program runs fine if I use IE to create the data connection first, but teaching this to users is not exactly ideal).
I have been trying to use the ConnMgrEstablishConnection And ConnMgrMapURL API functions as described by Microsoft, but I think I’m getting something wrong in how windev needs to call the API.
Can anyone see what I am doing wrong in the following, or tell me how they get windev mobile to make a network connection ( none of the built in functions I have used will attempt to get the PDA to connect to the network)?
When I call ConnMgrMapURL I get windows error 12006 which indicates it doesn’t think the URL is correct.
When I hardcode the GUID that should be returned from ConnMgrMapURL and call ConnMgrEstablishConnection I get an access denied error. Although my app is not running in privileged mode, neither of the API’s are privileged. So I suspect it is to do with how I am calling it then that it shouldn’t work for a good reason.
I'm using an Imate 9502 running Windows Mobile 6. I am using SOAP for the data connections not hyperfile connections.
MyURLStruct is structure
sURL is string on 100
END
stMyURL is MyURLStruct
stMyURL:sURL = URLEncode("http://www.google.com/")
sGUID is string on 100
GUIDStruct is structure
GUIDPtr is int
END
stGUID is GUIDStruct
stGUID:GUIDPtr = &sGUID

Info(API("CELLCORE","ConnMgrMapURL",&stMyURL,&stGUID)) // Messages -2147024809
// Passing a String or a &String as the for the url gives me errorcode 87 – Invalid parameter, passing another instance of stGUID for the URL also gives the 12006 errorcode.
Info(ErrorInfo(errSystemCode)) // Messages 12006

API
HRESULT WINAPI ConnMgrMapURL(
LPCTSTR pwszURL,
GUID * pguid,
DWORD * pdwIndex
);
Calling ConnMgrEstablishConnection …
CONNMGR_CONNECTIONINFO is structure

cbSize is int on 4
dwParams is unsigned int
dwFlags is unsigned int
dwPriority is unsigned int

bExclusive is boolean
bDisabled is boolean
guidDestNet is Buffer on 36 //buffer because string on 36 is 37 bytes and gave invalid parameter I believe on cbSize
hWnd is system int
uMsg is unsigned int
lParam is int on 4
ulMaxCost is unsigned int
ulMinRcvBw is unsigned int
ulMaxConnLatency is unsigned int
END
ConnInfo is CONNMGR_CONNECTIONINFO
ConnInfo:cbSize = Dimension(ConnInfo)
ConnInfo:dwParams = 1 // CONNMGR_PARAM_GUIDDESTNET
ConnInfo:dwFlags = 1 // CONNMGR_FLAG_PROXY_HTTP
ConnInfo:bExclusive = False
ConnInfo:dwPriority = 32768 // CONNMGR_PRIORITY_USERINTERACTIVE ;
ConnInfo:hWnd = 0
ConnInfo:guidDestNet = "436EF144-B4FB-4863-A041-8F905A62C572" // defined as INTERNET Would come from the ConnMgrMapURL API call
nConnectionHandle is system int

Info(API("CELLCORE","ConnMgrEstablishConnection",&ConnInfo,&nConnectionHandle)) // Messages -2147024809
Info(ErrorInfo(errSystemMessage)) // Messages access denied

API
HRESULT WINAPI ConnMgrEstablishConnection(
CONNMGR_CONNECTIONINFO * pConnInfo,
HANDLE * phConnection
);

typedef struct _CONNMGR_CONNECTIONINFO {
DWORD cbSize;
DWORD dwParams;
DWORD dwFlags;
DWORD dwPriority;
BOOL bExclusive;
BOOL bDisabled;
GUID guidDestNet;
HWND hWnd;
UINT uMsg;
LPARAM lParam;
ULONG ulMaxCost;
ULONG ulMinRcvBw;
ULONG ulMaxConnLatency;
} CONNMGR_CONNECTIONINFO;

Thanks
Mel
Posté le 02 février 2009 - 12:15
Have a look at NetOpenRemoteAccess() .
Someone on the old WD forum once told this should do the trick.
Arie
Posté le 03 février 2009 - 08:34
Thanks for the info. It does seam like this should work but I’m having problems with the NetOpenRemoteAccess call. When I test it on my HTC touch diamond it works to begin with (although the connection appears to be a windev only one and not shared and shown in windows), but if I use internet explorer it makes it’s own connection and the windev software can’t connect anymore.
On the companies I-mate 9502 it doesn’t work at all.
I know the documentation says that this can take a long time, but even after about 10 minutes it’s still locked (and I keep tapping the screen to keep it alive). I can see that it is attempting to do something because in this time the box to the right of the start menu changes from 3G to H (Sim is for a 850Mhz 3G Network) as it searches for a connection, but it doesn’t bring up the normal “Connecting to …” popup that other apps do.
If I then try to run IE while it is doing this IE brings up the normal “Connecting to …” popup but that connection attempt ultimately fails telling me “Remote Party Has Ended The Connection”. But, the windev app is still stuck trying to connect.
I tried this several times, three times I simply had to turn the PDA off and on before IE could connect, another time I had to do a hard reset on the device before even IE could create a network connection. I’ve tried a couple of freeware apps and they all happily create connections, so there aren’t any differences in the I-Mate that standard apps have problems with.
I’ve sent the info to PCSoft since it seams like this call is not working correctly, although any other input would be appreciated.
Posté le 10 mars 2009 - 08:35
FYI
PCSoft have gotten back with a solution. They have given me a new DLL which resolves some of these problems. If you have the same issues I suggest you get the DLL's from them.
Posté le 24 mars 2009 - 02:14
Hi Mel,
Could you send me the dll as a zip archive?
Cheers
Bob