I have one application that interacts with the server. If the server is down then then I will get ERROR_WINHTTP_CANNOT_CONNECT I am using getLastError() API to get this error code, I am handling this error code to display proper error messages to the users. This program works fine in Windows 2003. When i tried with Windows7 i am not getting any error, getLastError() API returns 0 every time even if error is occurred. I am using C++ as of programming language is concerned.
Thanks In advance
Santhu
I have observed different behavior of GetLastError API in Windows 2003 and in Windows 7.
Below are my observation details
In windows 2003:
Example Code:
WinHttpOpen ()– Completes successfullyWinhttpconnect()– This API is failed due to some reasons, say error code 12029GetLastErrorCode()– Returns error code 12029 as expectedWinHttpCloseHandle(hOpen); – Closing handle for HttpOpen, completes successfillyGetLastErrorCode()– Returns error code 12029In Windows 7
Example Code:
WinHttpOpen ()– Completes successfullyWinhttpconnect()– This API is failed due to some reasons, say error code 12029GetLastErrorCode()– Returns error code 12029 as expectedWinHttpCloseHandle(hOpen);– Closing handle for HttpOpen, completes successfullyGetLastErrorCode()– Returns error code 0 // see the difference with Windows 2003 example, on windows 2003 this API returns last error which is 1209