This documentation is archived and is not being maintained.

IMAGE Sample: Creates an ActiveX Control That Downloads Asynchronously

The IMAGE sample demonstrates how to use MFC to build an ActiveX control that is capable of downloading data asynchronously. The control has a property based on the CDataPathProperty class.

IMAGE can display a bitmap image from any .bmp file. The ImagePath property of the control provides a path to the image. If the image is large and the download takes place over a slow link, the asynchronous support built into the CDataPathProperty object managing the path becomes active and renders the data to the control's painting code without blocking other processing.

The control features a simple property page that gives access to the ImagePath property as well as the AutoSize property. The AutoSize property, if set to TRUE, automatically snaps the size of the control to the size of the image it contains. If the AutoSize property is FALSE, the automatic sizing is disabled.

The image control also implements a read-only Boolean property named ReadyState. ReadyState is TRUE if the control has successfully read and presented all the data in the image stream. ReadyState is FALSE until the control is fully initialized.

See Controls Samples for details on adding a control to the Toolbox, manually registering a control, and using the ActiveX Control Test Container.

Note   Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.

See Also

MFC Samples

Show: