Win32 error codes in the 12xxx range are from the WinInet API. Error 12018
is ERROR_INTERNET_INCORRECT_HANDLE_TYPE.
The error is caused because you cannot set the PROXY_USERNAME (and
PROXY_PASSWORD) option on the InternetSession handle; those options are
supported only on the Connect and Request handles.
WinInet errors are documented on-line at:
http://support.microsoft.com/default.aspx?scid=kb;en-us;193625
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/wininet_errors.asp.
In order to use FormatMessage with the WinInet error codes, you must specify
the FORMAT_MESSAGE_FROM_HMODULE flag and the handle of the WinInet module
(as the lpSource parameter). For example:
FormatMessage(FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS,
GetModuleHandle("wininet.dll"),
dwErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuffer,
0, // FormatMessage allocs buffer; use LocalFree(lpMsgBuffer) to
free
NULL);
Hope that helps.
Stephen
Post by ASmallCInternetSession::SetOption() and QueryOption() with
INTERNET_OPTION_PROXY_USERNAME are returning FALSE. GetLastError() then
returns 0x2EF2 (12018), but this cannot be resolved by FormatMessage(). What
is this error?
Thank you,