Connection Manager setup
- From: "Mo" <marabo82@xxxxxxxxxxx>
- Date: 10 Oct 2006 12:31:47 -0700
Hello all
i posted this question in microsoft.public.pocketpc.developer and i got
little help
then i found this group which seems like the wireless group
i have a small application that uses WinInet to download files from a
web server
the application works fine when the phone is cradled/on the emulator
(WM 5.0 SP/PPC)
when the deploy the application to the phone and its not cradled, i
don't seem to have an Internet connection unless i have Internet
Explorer running in the background :-(
I do have a data plan on my GSM phone, i can access my email/the web
etc.
if i close IE my app can't access the server no more and InternetOpen
will succeed while InternetOpenUrl will fail.
i have the following code to establish connection to the connection
manager, the call to ConnMgrEstablishConnectionSync() fails all the
time so i used
ConnMgrEstablishConnection() instead which succeeds on both cases
(phone cradled and not cradled)
Regards
Mo
<code>
HRESULT hr = 1;
BOOL bResult = TRUE;
HANDLE hConnMgr = ConnMgrApiReadyEvent();
GUID guidNetworkObject;
CONNMGR_CONNECTIONINFO connectionInfo = {0};
//Check hresult returned by ConnMgrMapURL() to make sure the
network id is valid.
//The ConnMgrMapURL function maps a URL to the globally unique
identifier
//(GUID) of the network to which the device is connected.
hr = ConnMgrMapURL(TEXT("http://www.msn.com"),
&guidNetworkObject, NULL);
if (FAILED(hr))
{
printf("Failed to MapURL %d****",GetLastError());
}
connectionInfo.cbSize = sizeof(CONNMGR_CONNECTIONINFO);
connectionInfo.guidDestNet =
guidNetworkObject;//IID_DestNetInternet;
connectionInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET
| CONNMGR_PARAM_MAXCONNLATENCY;//CONNMGR_PARAM_GUIDDESTNET;
connectionInfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
connectionInfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
connectionInfo.bExclusive = FALSE;
connectionInfo.bDisabled = FALSE;
connectionInfo.hWnd = NULL;
connectionInfo.uMsg = 0;
connectionInfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
HANDLE hConn = NULL;
hr=ConnMgrEstablishConnection(&connectionInfo, &hConn);
if (FAILED(hr))
{
printf("Failed to Connect %d****",GetLastError());
}
else
{
printf("Connected ****");
}
/*
this call fails all the time
hr = ConnMgrEstablishConnectionSync(&connectionInfo, &hConnMgr,
30000, &dwStatus);
if (FAILED(hr) || dwStatus != CONNMGR_STATUS_CONNECTED)
{
OutputDebugString(TEXT("ConnMgrEstablishConnectionSync failed"));
printf("Last Error: %d...\r\n", GetLastError());
return FALSE;
}*/
m_fIsConnected=TRUE;
_hOpenHandle = InternetOpen(szAgent,INTERNET_OPEN_TYPE_DIRECT,
NULL,
NULL, NULL);
if(NULL == _hOpenHandle)
{
//error handling here
return FALSE;
}
//open the file
_hResourceHandle = InternetOpenUrl(_hOpenHandle
,szServerURL,
NULL, 0, INTERNET_FLAG_RAW_DATA , 0);
if (NULL ==_hResourceHandle)
{
//error handling here
return FALSE;
}
......
}
</code>
.
- Prev by Date: Re: Registry
- Next by Date: Re: Can I set my wireless NIC on my PC as access point (AP) ?
- Previous by thread: Registry
- Next by thread: Re: Can I set my wireless NIC on my PC as access point (AP) ?
- Index(es):
Relevant Pages
|