CInternetSession::EnableStatusCallback

BOOL EnableStatusCallback( BOOL bEnable = TRUE );
Throw ( CInternetException );

Return Value

Nonzero if successful; otherwise 0. If the call fails, determine the cause of the failure by examining the thrown CInternetException object.

Parameters

bEnable

Specifies whether callback is enabled or disabled. The default is TRUE.

Remarks

Call this member function to enable status callback. When handling status callback, you can provide status about the progress of the operation (such as resolving name, connecting to server, and so on) in the status bar of the application. Displaying operation status is especially desirable during a long-term operation.

You can set a callback routine for synchronous operations; however, you must establish a callback routine for asynchronous operations because the asynchronous API makes a callback with INTERNET_STATUS_REQUEST_COMPLETE to indicate that the request has completed.

A callback for an asynchronous operation will be on a thread other than the one for the original request. The call can fail with an ERROR_IO_PENDING error if the request is not complete when the status callback occurs. The callback may be callled in a thread context different from the thread which initiated the request.

Because callbacks occur during the request’s processing, the application should spend as little time as possible in the callback to prevent degradation of data throughput to the network. For example, putting up a dialog box in a callback may be such a lengthy operation that the server terminates the request.

The status callback cannot be removed as long as any callbacks or any asynchronous functions are pending.

Note   To handle any operations asynchronously, three conditions must be set:

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::CInternetSession