Err = GetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM..,., Err.....
But I don't get anything meaningful back.
Do I have to create a huge case statement to convert these
numbers into meaningful descriptions? Doesn't WinInet
have a function you can send the code to for getting a meaningful
description?
try:
DWORD hResult = FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,
GetModuleHandle("wininet.dll"),
dError,
0,
lpBuffer,
256,
NULL);
I hope it helps you!
Heitor
"Troy Wolbrink" <wolb...@ccci.org> wrote in message
news:uwQJhPO8$GA.148@cppssbbsa04...
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Name : TranslateErrorCode
' Purpose : Provides message corresponding to DLL error codes
' Parameters : The DLL error code
' Return val : String containing message
' Algorithim : Selects the appropriate string
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function TranslateErrorCode(ByVal lErrorCode As Long) As String
Select Case lErrorCode
Case 12001: TranslateErrorCode = "No more handles could be generated
at this time"
Case 12002: TranslateErrorCode = "The request has timed out."
Case 12003: TranslateErrorCode = "An extended error was returned
from the server."
Case 12004: TranslateErrorCode = "An internal error has occurred."
Case 12005: TranslateErrorCode = "The URL is invalid."
Case 12006: TranslateErrorCode = "The URL scheme could not be
recognized, or is not supported."
Case 12007: TranslateErrorCode = "The server name could not be
resolved."
Case 12008: TranslateErrorCode = "The requested protocol could not
be located."
Case 12009: TranslateErrorCode = "A request to InternetQueryOption
or InternetSetOption specified an invalid option value."
Case 12010: TranslateErrorCode = "The length of an option supplied
to InternetQueryOption or InternetSetOption is incorrect for the type of
option specified."
Case 12011: TranslateErrorCode = "The request option can not be set,
only queried. "
Case 12012: TranslateErrorCode = "The Win32 Internet support is
being shutdown or unloaded."
Case 12013: TranslateErrorCode = "The request to connect and login
to an FTP server could not be completed because the supplied user name
is incorrect."
Case 12014: TranslateErrorCode = "The request to connect and login
to an FTP server could not be completed because the supplied password is
incorrect. "
Case 12015: TranslateErrorCode = "The request to connect to and
login to an FTP server failed."
Case 12016: TranslateErrorCode = "The requested operation is
invalid. "
Case 12017: TranslateErrorCode = "The operation was canceled,
usually because the handle on which the request was operating was closed
before the operation completed."
Case 12018: TranslateErrorCode = "The type of handle supplied is
incorrect for this operation."
Case 12019: TranslateErrorCode = "The requested operation can not be
carried out because the handle supplied is not in the correct state."
Case 12020: TranslateErrorCode = "The request can not be made via a
proxy."
Case 12021: TranslateErrorCode = "A required registry value could
not be located. "
Case 12022: TranslateErrorCode = "A required registry value was
located but is an incorrect type or has an invalid value."
Case 12023: TranslateErrorCode = "Direct network access cannot be
made at this time. "
Case 12024: TranslateErrorCode = "An asynchronous request could not
be made because a zero context value was supplied."
Case 12025: TranslateErrorCode = "An asynchronous request could not
be made because a callback function has not been set."
Case 12026: TranslateErrorCode = "The required operation could not
be completed because one or more requests are pending."
Case 12027: TranslateErrorCode = "The format of the request is
invalid."
Case 12028: TranslateErrorCode = "The requested item could not be
located."
Case 12029: TranslateErrorCode = "The attempt to connect to the
server failed."
Case 12030: TranslateErrorCode = "The connection with the server has
been terminated."
Case 12031: TranslateErrorCode = "The connection with the server has
been reset."
Case 12036: TranslateErrorCode = "The request failed because the
handle already exists."
Case Else: TranslateErrorCode = "Error details not available."
End Select
End Function
FORMAT_MESSAGE_FROM_HMODULE ||
FORMAT_MESSAGE_FROM_SYSTEM
that FormatMessage searches the system message table if the
message is not found in "wininet.dll". I'm glad I didn't have
to write and maintain some huge case statement.