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("[
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