c++ - CInternetSession::OpenURL on Windows Mobile causes error 12029 (cannot connect) -


I CInternetSession :: OpenUrl (coding in C ++ with MFC) on Windows Mobile 5. I always get an exception with error code 12029 (can not connect).

I doubt that I have to use the Connection Manager API to make the connection first. Can anyone confirm this?

I am going to try coding it here on the basis of information, and if I am suitable, then I will report my experiences as a reply.

I have successfully opened a connection using this code:

  // What type of connection is required for this URL? GUID guid; HRESULT hresult = ConnMgrMapURL ((LPCTTR) URL, and grid, faucet); If (! SUCCEDED (hresult)) {delete url]; AError = CartoType :: KErrorInternetIo; Return tap; } // Get Connection CONNMGR_CONNECTIONINFO cinfo; Memset (& cinfo, 0, sizeof (cinfo)); Cinfo.cbSize = sizeof (cinfo); Cinfo.bDisabled = FALSE; Cinfo.bExclusive = FALSE; Cinfo.guidDestNet = Gid; Cinfo.dwParams = CONNMGR_PARAM_GUIDDESTNET; Cinfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP; Cinfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE; DWORD status; Hresult = ConnMgrEstablishConnectionSync (and cinfo, and iConnectionHandle, 15000, and status);  

And I know that this works because it sets the status of CONNMGR_STATUS_CONNECTED ; However, I immediately call CInternetSession :: OpenURL and it throws an exception.

Here are some code that works, it uses low-level Windows API, not MFC . This is probably not ideal and involves unnecessary ones (do I really need a conbound call?), But it works:

  // What type of connection to this URL Required GUID guid; HRESULT hresult = ConnMgrMapURL ((LPCTTR) URL, and grid, faucet); If (! SUCCEDED (hresult)) {delete url]; AError = CartoType :: KErrorInternetIo; Return tap; } // Get Connection CONNMGR_CONNECTIONINFO cinfo; Memset (& cinfo, 0, sizeof (cinfo)); Cinfo.cbSize = sizeof (cinfo); Cinfo.bDisabled = FALSE; Cinfo.bExclusive = FALSE; Cinfo.guidDestNet = Gid; Cinfo.dwParams = CONNMGR_PARAM_GUIDDESTNET; Cinfo.dwFlags = CONNMGR_FLAG_PROXY_HTTP; Cinfo.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE; DWORD status; Hresult = ConnMgrEstablishConnectionSync (and cinfo, and iConnectionHandle, 15000, and status); HINTERNET hinternet = InternetOpen (_T ("CartoType"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); HINTERNET hfile = InternetOpenUrl (hinternet, (LPCTSTR) url, NULL, 0,0,1);  

This gives a valid handle that I can read using InternetReadFile, then I can stop using InternetCloseHandle.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -