當PDA的3G sim卡有插入時,執行PDA上的IE程式,會自動連上3G網路。
但是自己寫的網路程式,卻不會自己連上3G網路。
解決方法如下:
HANDLE hConnection;
int Connect3G(DWORD& pdwStatus)
{
CONNMGR_CONNECTIONINFO connInfo;
connInfo.cbSize = sizeof(connInfo);
connInfo.dwParams = CONNMGR_PARAM_GUIDDESTNET;
connInfo.dwFlags = 0;
connInfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
connInfo.bExclusive = true;
connInfo.bDisabled = false;
connInfo.guidDestNet = IID_DestNetInternet;
connInfo.hWnd = NULL;
//connInfo.uMsg = WM_APP_CONNMGR;
connInfo.lParam = (LPARAM)0;
// Make the connection
// ConnMgrEstablishConnection(&connInfo , &hConnection);
// DWORD pdwStatus ;
ConnMgrEstablishConnectionSync(&connInfo , &hConnection,60000,&pdwStatus);
return 0;
}
void Disconnect3G()
{
ConnMgrReleaseConnection(hConnection,0);
}
沒有留言:
張貼留言