CInternetSession::OnStatusCallback

virtual void OnStatusCallback( DWORD dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength );

Parameters

dwContext

The context value supplied by the application.

dwInternetStatus

A status code which indicates why the callback is being made. See Remarks for a table of possible values.

lpvStatusInformation

A pointer to a buffer containing information pertinent to this callback.

dwStatusInformationLength

The size of lpvStatusInformation.

Remarks

This member function is called by the framework to update the status when status callback is enabled and an operation is pending. You must first call EnableStatusCallback to take advantage of status callback. 

The dwInternetStatus parameter indicates the operation being performed and determines what the contents of lpvStatusInformation will be. dwStatusInformationLength indicates the length of the data included in lpvStatusInformation. The following status values for dwInternetStatus are defined as follows:

Value Meaning
INTERNET_STATUS_RESOLVING_NAME Looking up the IP address of the name contained in lpvStatusInformation.
INTERNET_STATUS_NAME_RESOLVED Successfully found the IP address of the name contained in lpvStatusInformation.
INTERNET_STATUS_CONNECTING_TO_SERVER Connecting to the socket address (SOCKADDR) pointed to by lpvStatusInformation.
INTERNET_STATUS_CONNECTED_TO_SERVER Successfully connected to the socket address (SOCKADDR) pointed to by lpvStatusInformation.
INTERNET_STATUS_SENDING_REQUEST Sending the information request to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_ REQUEST_SENT Successfully sent the information request to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_RECEIVING_RESPONSE Waiting for the server to respond to a request. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_RESPONSE_RECEIVED Successfully received a response from the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_CLOSING_CONNECTION Closing the connection to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_CONNECTION_CLOSED Successfully closed the connection to the server. The lpvStatusInformation parameter is NULL.
INTERNET_STATUS_HANDLE_CREATED Used by the Win32 API function InternetConnect to indicate that it has created the new handle. This lets the application call the Win32 function InternetCloseHandle from another thread if the connect is taking too long. See the ActiveX SDK for more information about these functions.
INTERNET_STATUS_HANDLE_CLOSING Successfully terminated this handle value.
INTERNET_STATUS_REQUEST_COMPLETE Successfully completed the asynchronous operation. See the CInternetSession constructor for details on INTERNET_FLAG_ASYNC.The lpvStatusInformation parameter points at an INTERNET_ASYNC_RESULT structure, and dwStatusInformationLength contains the final completion status of the asynchronous function. If this is ERROR_INTERNET_EXTENDED_ERROR, the application can retrieve the server error information by using the Win32 function InternetGetLastResponseInfo. See the ActiveX SDK for more information about this function.

In the case of INTERNET_STATUS_REQUEST_COMPLETE, lpvStatusInformation points at an INTERNET_ASYNC_RESULT structure, which is defined as:

Override this member function to require some action before a status callback routine is performed.

Note   Status callbacks need thread-state protection. If you are using MFC in a shared library, add the following line to the beginning of your override:

AFX_MANAGE_STATE( AfxGetAppModuleState( ) );

For more information about asynchronous operations, see the article Internet First Steps: WinInet in Visual C++ Programmer’s Guide.

CInternetSession OverviewClass MembersHierarchy Chart

See Also   CInternetSession::EnableStatusCallback, CInternetSession::GetContext