Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method notifies registered objects and applications of the progress of a downloading operation.

Syntax

HRESULT OnProgress(
  DWORD 
dwProgressCurrent, 
  DWORD 
dwProgressMaximum, 
  BOOL 
fAccurate, 
  BOOL 
fOwner 
);

Parameters

dwProgressCurrent

[in] Amount of data available.

dwProgressMaximum

[in] Total amount of data to be downloaded.

fAccurate

[in] Values in dwProgressCurrentand dwProgressMaximumare either reliable (TRUE) or unreliable (FALSE).

The FALSE value indicates that control structures for determining the actual position of, or amount of, data yet to be downloaded are not available.

fOwner

[in] Value that indicates whether this IProgressNotify::OnProgresscall can control the blocking behavior of the operation.

If TRUE, the caller can use return values from OnProgressto block (STG_S_BLOCK), retry (STG_S_RETRYNOW), or monitor (STG_S_MONITORING) the operation.

If FALSE, the return value from OnProgresshas no influence on blocking behavior.

Return Value

This function supports the standard return values E_OUTOFMEMORY, E_UNEXPECTED, E_INVALIDARG, and E_FAIL.

The following table shows the additional return values for this method.

Value Description

STG_S_RETRYNOW

The caller is to retry the operation immediately. This value is most useful for applications that do blocking from within the callback routine.

STG_S_BLOCK

The caller is to block the download and retry the call as needed to determine if additional data is available. This is the default behavior if no sinks are registered on the connection point.

STG_S_MONITORING

The callback recipient relinquishes control of the downloading process to one of the other objects or applications that have registered progress notification sinks on the same stream. This is useful if the notification sink is interested only in gathering statistics.

E_PENDING

Data is currently unavailable. The caller is to try again after some desired interval. The notification sink returns this value if the asynchronous storage is to operate in non-blocking mode.

Remarks

Sinks may be inherited by any substorage or substream of a given storage. If no sink is registered, the thread will block until the requested data becomes available, or the download is canceled by the downloader.

Where multiple objects or applications have registered progress notification sinks on a single stream, only one of them can control the behavior of a download. Ownership of the download goes to the first sink to register with the storage or stream.

Any advise sinks that may have been inherited from the parent storage (if the storage was created with ASYNC_MODE_COMPATIBILITY).

Any one of the sinks can relinquish control to the next connection point by returning STG_S_MONITORING to the connection point making the current caller.

Once a connection point obtains control (through receiving STG_S_BLOCK or STG_S_RETRYNOW), all subsequent connection points calling IProgressNotify::OnProgresswill set fOwnerto FALSE.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later