When Internet Explorer is ran on my mobile phone it automatically connects to Orange GPRS network and I see a popup/hint on top of the screen saying "Connecting to GPRS...".
I want to do the same in my application. Detect somehow that the network if available and just connect to it. I've looked in settings and iI think this is somehow connnected to modem connections but still I dont know how to start them from code.
Any help/link will be appreciated.

How to connect to GPRS network from code?
eldiener
hiner129
CONNMGR_CONNECTIONINFO ci = {0};
PROXY_CONFIG pcProxy = {0};
DWORD dwStatus = 0;
DWORD dwIndex = 0;
HRESULT hr = S_OK;
HANDLE hConnection = NULL;
HANDLE hOpen = NULL;
LPTSTR pszProxy = NULL;
DWORD dwAccessType;
GUID guidTest;
// Register with the connection manager
ci.cbSize = sizeof(CONNMGR_CONNECTIONINFO);
ci.dwParams = CONNMGR_PARAM_GUIDDESTNET;
ci.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
ci.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
const GUID IID_ConnPrv_IProxyExtension = {0xaf96b0bd,0xa481,0x482c,{0xa0,0x94,0x44,0x87,0x67,0xa0,0xc0}};
// Map the URL to a network, if we can
hr = ConnMgrMapURL(_T("your url"), &(ci.guidDestNet), &dwIndex);
//Check hr value.
hr = ConnMgrEstablishConnectionSync(&ci, &hConnection, 25000, &dwStatus);
//Check hr value.
//Make sure dwStatus == CONNMGR_STATUS_CONNECTED
// Get proxy information.
pcProxy.dwType = CONNMGR_FLAG_PROXY_HTTP;
hr = ConnMgrProviderMessage( hConnection, &IID_ConnPrv_IProxyExtension, NULL, 0, 0, (PBYTE)&pcProxy, sizeof(pcProxy));
if (S_OK == hr)
{
dwAccessType = INTERNET_OPEN_TYPE_PROXY;
pszProxy = (LPTSTR) LocalAlloc(LPTR, ARRAYSIZE(pcProxy.szProxyServer));
// Make sure pszProxy was allocated.
hr = StringCchCopyN(pszProxy, ARRAYSIZE(pcProxy.szProxyServer),
pcProxy.szProxyServer, ARRAYSIZE(pcProxy.szProxyServer));
//Check hr value
}
else if (E_NOINTERFACE == hr)
{
dwAccessType = INTERNET_OPEN_TYPE_DIRECT;
pszProxy = NULL;
// Reset hr, since it's not really an error here.
hr = S_OK;
}
Holistic
Please do not cross post. Merging…
GKW82
waruwaru
I want to do the same in my application. Detect somehow that the network if available and just connect to it. I've looked in settings and iI think this is somehow connnected to modem connections but still I dont know how to start them from code.
Any help/link will be appreciated.
Bazzer
None. You need to convert code above from C++ to C#. If you don't know C++/don’t know how to convert/don't want to convert - OpenNetcf.org has a managed wrapper for connection manager.
Priya Shekhar
Use Connection Manager API. If you not familiar with it, please run a search, it was answered many times before.