Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error Numbers with VB

157 views
Skip to first unread message

Seán Hennessy

unread,
Dec 3, 2002, 11:10:29 AM12/3/02
to
Folks, I'm a lowly VB developer with next to zero knowledge of how
error handling works in C++ apps. I'm writing a VB application using
WinHTTP 5.0, and I'm struggling to understand the error numbers I get
back. I need to trap specific errors and take action accordingly.

I took the error numbers I'm using from WinHTTP.h, which defines
ERROR_WINHTTP_TIMEOUT as 12002, or 0x2002 in Hex. The actual error
number I get back is -2147012894, which is 0x80072EE2 in Hex. Clearly
the rightmost 8 bytes are the number I want, but where does the rest
of the number come from?

I'd be very grateful for any information.

Thanks,
Seán

Stephen Sulzer [Microsoft]

unread,
Dec 6, 2002, 11:03:29 PM12/6/02
to

Hello Seán,

Hey, there's nothing lowly about being a Visual Basic developer. :-)

The ERROR_WINHTTP_* error codes you see in WinHTTP.h are the Win32 error
codes that the WinHTTP Win32 API functions return. When using the
WinHttpRequest COM component, a (16-bit) Win32 error code is translated into
a (32-bit) HRESULT, which is the COM error code format. HRESULTs are
interpreted in hexadecimal, so if you get a value like -2147012894, the
first thing to do is to convert it to hex (0x80072EE2).

Win32 error codes translated into HRESULTs will be of the form 0x8007xxxx,
where 'xxxx' is the hexadecimal 16-bit Win32 error code. (The left-most '8'
in the HRESULT indicates a fatal error; the '7' indicates that the error
originated from a Win32 API.)

WinHTTP Win32 API error codes are in the 12001 to 12185 range; as COM
HRESULTs they will be in the range 0x80072EE1 to 0x80072F99.


Here is some official documentation on HRESULTs from the Platform SDK:

Structure of COM Error Codes
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/error_5g6r.asp

Error Handling
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/error_83qf.asp

Regards,

Stephen Sulzer
Microsoft Corporation


This posting is provided "AS IS" with no warranties, and confers no rights.

"Seán Hennessy" <seanhe...@eircom.net> wrote in message
news:fc071652.02120...@posting.google.com...

0 new messages