WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get WinInet Error Description String

 Keywords: error string description Wininet code 

Short Way:

; Get Wininet Error String
#DefineFunction udfWinInetErrorDesc( Err )
   AddExtender( 'wwint44i.dll' )
   ;Get module Handle
   modulehandle = DllCall(StrCat(DirWindows(1),"kernel32.dll"),long:'GetModuleHandleA',lpstr:'wininet.dll')
   If modulehandle == 0
      err = DllLastError()
      Message('GetModuleHandleA Failed', err)
   ; Get Formated Message
   Buffer = BinaryAlloc(256)
   rslt = DllCall(StrCat(DirWindows(1),"kernel32.dll"),long:"FormatMessageA",long:FORMAT_MESSAGE_FROM_HMODULE,long:modulehandle,long:Err,long:0,lpbinary:Buffer,long:256,long:0)
   If rslt == 0
      Text = StrCat( "Error #", Err )
      Text = BinaryPeekStr(Buffer,0,256)
   Return Text

 err = 12007
 text = udfWinInetErrorDesc( Err )
 Message( 'WinInetError', text)

Long way:

#DefineFunction Udf_wininetGetErrDesc(err)
   ;if no error passed or invalid error
   If err == 0 || err == "" || err < 12001
     ErrDesc = "*UNKNOWN*"
     Return ErrDesc
   ;redifine error
   errorcode = err - 12000

   ;Define all error strings
   err1   =  'ERROR_INTERNET_OUT_OF_HANDLES: No more handles could be generated at this time.'
   err2   =  'ERROR_INTERNET_TIMEOUT: The request has timed out.'
   err3   =  'ERROR_INTERNET_EXTENDED_ERROR: An extended error was returned from the server. This is typically a string or buffer containing a verbose error message. Call InternetGetLastResponseInfo to retrieve the error text.'
   err4   =  'ERROR_INTERNET_INTERNAL_ERROR: An internal error has occurred.'
   err5   =  'ERROR_INTERNET_INVALID_URL: The URL is invalid.'
   err6   =  'ERROR_INTERNET_UNRECOGNIZED_SCHEME: The URL scheme could not be recognized or is not supported.'
   err7   =  'ERROR_INTERNET_NAME_NOT_RESOLVED: The server name could not be resolved.'
   err8   =  'ERROR_INTERNET_PROTOCOL_NOT_FOUND: The requested protocol could not be located.'
   err9   =  'ERROR_INTERNET_INVALID_OPTION: A request to InternetQueryOption or InternetSetOption specified an invalid option value.'
   err10   =  'ERROR_INTERNET_BAD_OPTION_LENGTH: The length of an option supplied to InternetQueryOption or InternetSetOption is incorrect for the type of option specified.'
   err11   =  'ERROR_INTERNET_OPTION_NOT_SETTABLE: The request option cannot be set, only queried.'
   err12   =  'ERROR_INTERNET_SHUTDOWN:The Win32 Internet function support is being shut down or unloaded.'
   err13   =  'ERROR_INTERNET_INCORRECT_USER_NAME: The request to connect and log on to an FTP server could not be completed because the supplied user name is incorrect.'
   err14   =  'ERROR_INTERNET_INCORRECT_PASSWORD: The request to connect and log on to an FTP server could not be completed because the supplied password is incorrect.'
   err15   =  'ERROR_INTERNET_LOGIN_FAILURE: The request to connect to and log on to an FTP server failed.'
   err16   =  'ERROR_INTERNET_INVALID_OPERATION:The requested operation is invalid.'
   err17   =  'ERROR_INTERNET_OPERATION_CANCELLED: The operation was canceled, usually because the handle on which the request was operating was closed before the operation completed.'
   err18   =  'ERROR_INTERNET_INCORRECT_HANDLE_TYPE: The type of handle supplied is incorrect for this operation.'
   err19   =  'ERROR_INTERNET_INCORRECT_HANDLE_STATE:The requested operation cannot be carried out because the handle supplied is not in the correct state.'
   err20   =  'ERROR_INTERNET_NOT_PROXY_REQUEST: The request cannot be made via a proxy.'
   err21   =  'ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND: A required registry value could not be located.'
   err22   =  'ERROR_INTERNET_BAD_REGISTRY_PARAMETER:A required registry value was located but is an incorrect type or has an invalid value.'
   err23   =  'ERROR_INTERNET_NO_DIRECT_ACCESS:Direct network access cannot be made at this time.'
   err24   =  'ERROR_INTERNET_NO_CONTEXT: An asynchronous request could not be made because a zero context value was supplied.'
   err25   =  'ERROR_INTERNET_NO_CALLBACK: An asynchronous request could not be made because a callback function has not been set.'
   err26   =  'ERROR_INTERNET_REQUEST_PENDING: The required operation could not be completed because one or more requests are pending.'
   err27   =  'ERROR_INTERNET_INCORRECT_FORMAT: The format of the request is invalid.'
   err28   =  'ERROR_INTERNET_ITEM_NOT_FOUND: The requested item could not be located.'
   err29   =  'ERROR_INTERNET_CANNOT_CONNECT: The attempt to connect to the server failed.'
   err30   =  'ERROR_INTERNET_CONNECTION_ABORTED: The connection with the server has been terminated.'
   err31   =  'ERROR_INTERNET_CONNECTION_RESET: The connection with the server has been reset.'
   err32   =  'ERROR_INTERNET_FORCE_RETRY: Calls for the Win32 Internet function to redo the request.'
   err33   =  'ERROR_INTERNET_INVALID_PROXY_REQUEST: The request to the proxy was invalid.'
   err36   =  'ERROR_INTERNET_HANDLE_EXISTS: The request failed because the handle already exists.'
   err37   =  'ERROR_INTERNET_SEC_CERT_DATE_INVALID: SSL certificate date that was received from the server is bad. The certificate is expired.'
   err38   =  'ERROR_INTERNET_SEC_CERT_CN_INVALID: SSL certificate common name (host name field) is incorrect. For example, if you entered and the common name on the certificate says'
   err39   =  'ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: The application is moving from a non-SSL to an SSL connection because of a redirect.'
   err40   =  'ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR: The application is moving from an SSL to an non-SSL connection because of a redirect.'
   err41   =  'ERROR_INTERNET_MIXED_SECURITY: Indicates that the content is not entirely secure. Some of the content being viewed may have come from unsecured servers.'
   err42   =  'ERROR_INTERNET_CHG_POST_IS_NON_SECURE: The application is posting and attempting to change multiple lines of text on a server that is not secure.'
   err43   =  'ERROR_INTERNET_POST_IS_NON_SECURE: The application is posting data to a server that is not secure.'
   err110   =  'ERROR_FTP_TRANSFER_IN_PROGRESS: The requested operation cannot be made on the FTP session handle because an operation is already in progress.'
   err111   =  'ERROR_FTP_DROPPED: The FTP operation was not completed because the session was aborted.'
   err130   =  'ERROR_GOPHER_PROTOCOL_ERROR: An error was detected while parsing data returned from the gopher server.'
   err131   =  'ERROR_GOPHER_NOT_FILE: The request must be made for a file locator.'
   err132   =  'ERROR_GOPHER_DATA_ERROR: An error was detected while receiving data from the gopher server.'
   err133   =  'ERROR_GOPHER_END_OF_DATA: The end of the data has been reached.'
   err134   =  'ERROR_GOPHER_INVALID_LOCATOR: The supplied locator is not valid.'
   err135   =  'ERROR_GOPHER_INCORRECT_LOCATOR_TYPE: The type of the locator is not correct for this operation.'
   err136   =  'ERROR_GOPHER_NOT_GOPHER_PLUS: The requested operation can only be made against a Gopher+ server or with a locator that specifies a Gopher+ operation.'
   err137   =  'ERROR_GOPHER_ATTRIBUTE_NOT_FOUND: The requested attribute could not be located.'
   err138   =  'ERROR_GOPHER_UNKNOWN_LOCATOR: The locator type is unknown.'
   err150   =  'ERROR_HTTP_HEADER_NOT_FOUND: The requested header could not be located.'
   err151   =  'ERROR_HTTP_DOWNLEVEL_SERVER: The server did not return any headers.'
   err152   =  'ERROR_HTTP_INVALID_SERVER_RESPONSE: The server response could not be parsed.'
   err153   =  'ERROR_HTTP_INVALID_HEADER: The supplied header is invalid.'
   err154   =  'ERROR_HTTP_INVALID_QUERY_REQUEST: The request made to HttpQueryInfo is invalid.'
   err155   =  'ERROR_HTTP_HEADER_ALREADY_EXISTS: The header could not be added because it already exists.'
   err156   =  'ERROR_HTTP_REDIRECT_FAILED: The redirection failed because either the scheme changed (for example, HTTP to FTP) or all attempts made to redirect failed (default is five attempts).'

   If IsDefined("err%errorcode%")
      ErrDesc = err%errorcode%
      ErrDesc = "*UNKNOWN*"
   Return ErrDesc


err = '12007'
ErrDesc = Udf_wininetGetErrDesc(err)
Pause('WinInet Error String', ErrDesc)

Article ID:   W17381
File Created: 2017:07:28:13:58:46
Last Updated: 2008:04:10:15:08:50