InternetErrorDlg

This function displays a dialog box for the error that is passed to it, if an appropriate dialog box exists. If the FLAGS_ERROR_UI_FILTER_FOR_ERRORS flag is used, the function also checks the headers for any hidden errors and displays a dialog box if needed.

At a Glance

Header file: Wininet.h
Windows CE versions: 2.12 and later

Syntax

DWORD InternetErrorDlg (HWND hWnd, HINTERNET hRequest,
DWORD dwError, DWORD dwFlags, LPVOID *lppvData);

Parameters

hWnd

[in] Handle to the parent window for any needed dialog box. This parameter can be NULL if no dialog box is needed.

hRequest

[in] [out] HINTERNET handle to the Internet connection used in the call to HttpSendRequest.

dwError

[in] Error value for which to display a dialog box. Can be one of the following values:

Value Description
ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR Notifies the user of the zone crossing to and from a secure site.
ERROR_INTERNET_INCORRECT_PASSWORD Displays a dialog box for obtaining the user's name and password. (On Microsoft Windows® 95, the function first attempts to use any cached authentication information for the server being accessed, before displaying a dialog box.)
ERROR_INTERNET_INVALID_CA Notifies the user that the Win32® Internet function does not recognize the certificate authority that generated the certificate for this Secure Sockets Layer (SSL) site.
ERROR_INTERNET_POST_IS_NON_SECURE Displays a warning about posting data to the server through a nonsecure connection.
ERROR_INTERNET_SEC_CERT_CN_INVALID Indicates that the SSL certificate Common Name (hostname field) is incorrect. Displays an Invalid SSL Common Name dialog box, and lets the user view the incorrect certificate. Also allows the user to select a certificate in response to a server request.
ERROR_INTERNET_SEC_CERT_DATE_INVALID Tells the user that the SSL certificate has expired.

dwFlags

[in] Unsigned long integer value that contains the action flags. Can be a combination of these values:

Value Description
FLAGS_ERROR_UI_FILTER_FOR_ERRORS Scans the returned headers for errors. Call after using HttpSendRequest. This option detects any hidden errors, such as an authentication error.
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS If the function succeeds, stores the results of the dialog box in the Internet handle.
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA Queries the Internet handle for needed information. The function constructs the appropriate data structure for the error. (For example, for Cert CN failures, the function grabs the certificate.)
FLAGS_ERROR_UI_SERIALIZE_DIALOGS Serializes authentication dialog boxes for concurrent requests on a password cache entry. The lppvData parameter should contain the address of a pointer to an INTERNET_AUTH_NOTIFY_DATA structure, and the client should implement a thread-safe, nonblocking callback function.

lppvData

[in] [out] Address of a data structure. The structure can be different for each error that needs to be handled.

Return Values

Returns one of the following values:

ERROR_SUCCESS

The function completed successfully.

ERROR_CANCELLED

The function was cancelled by the user.

ERROR_INTERNET_FORCE_RETRY

The function needs to redo its request.

Remarks

Authentication errors are hidden, since the call to HttpSendRequest will complete successfully, but the status code would indicate that the proxy or server requires authentication. The FLAGS_ERROR_UI_FILTER_FOR_ERRORS flag causes the function to search the headers for status codes that indicate user input is needed.

See Also

HttpSendRequest