Share via


Internet Downloading Using Asynchronous Monikers

OverviewHow Do I

The Internet requires new approaches to application design because of its slow network access. Applications should perform network access asynchronously to avoid stalling the user interface. The MFC class provides asynchronous support for downloading files.

Advantages of Asynchronous Monikers

You can use asynchronous monikers to:

  • Download code and files without blocking.

  • Download properties in ActiveX controls without blocking.

  • Receive notifications of downloading progress.

  • Track progress and ready state information.

  • Provide status information to the user about progress.

  • Allow the user to cancel a download at any time.

MFC Classes for Asynchronous Monikers

is derived from , which in turn is derived from . A COleStreamFile object represents a stream of data; a CMonikerFile object uses an IMoniker to obtain the data, and a CAsyncMonikerFile object does so asynchronously.

Asynchronous monikers are used primarily in Internet-enabled applications and ActiveX controls to provide a responsive user interface during file transfers. A prime example of this is the use of to provide asynchronous properties for ActiveX controls.

MFC Classes for Data Paths in ActiveX Controls

The MFC classes CDataPathProperty and implement ActiveX control properties that can be loaded asynchronously. Asynchronous properties are loaded after synchronous initiation. Asynchronous ActiveX controls repeatedly invoke a callback to indicate availability of new data during a lengthy property exchange process.

CDataPathProperty is derived from CAsyncMonikerFile. CCachedDataPathProperty is derived from CDataPathProperty. To implement asynchronous properties in your ActiveX controls, derive a class from CDataPathProperty or CCachedDataPathProperty, and override and other notifications you wish to receive.

What do you want to do?