共用方式為


ActiveX Controls on the Internet

OverviewHow Do I

ActiveX controls are the updated version of the OLE control specification. This article lists the advantages of using ActiveX controls, and requirements and design tips for ActiveX controls.

Controls are a primary architecture for developing programmable software components that can be used in a variety of different containers, including COM-aware Web browsers on the Internet. Any ActiveX control can be an Internet control and can add its functionality to an Active document or be part of a Web page. Controls on a Web page can communicate with each other using scripting.

Advantages of ActiveX Controls

ActiveX controls have several advantages, including:

  • Fewer required interfaces than previous OLE controls.

  • The ability to be windowless and always in-place active.

Requirements for an ActiveX Control

In order to be an ActiveX control, a control must:

  • Support the IUnknown interface.

  • Support additional interfaces as needed for functionality.

ActiveX Control Design Tips

Designing a control that will work well in an Internet environment requires consideration for the relatively low transmission rates on the Internet.

To improve performance of your controls, pay attention to efficiency considerations regarding:

  • Implementing the techniques described in the article ActiveX Controls: Optimization.

  • How a control is instantiated.

  • Keeping the control code size small.

    Small button and label controls, with only a few bytes of persistent data, are suitable for use in the Internet environment and work well inside browsers.

  • How persistent data is stored, both properties and large data BLOBs (such as a bitmap image or video data).

    Controls with significant amounts of persistent data, such as large bitmaps or AVI files, require careful attention to downloading method. A document or page can become visible as soon as possible, and allow the user to interact with the page while controls retrieve data in the background.

  • How components are downloaded and installed across the Internet.

    When downloading large streams such as bitmaps or video data, access a control's data asynchronously in cooperation with the container. Retrieve the data in an incremental or progressive fashion, working cooperatively with other controls that may also be retrieving data. Code can also be downloading asynchronously.

  • How progress is communicated to the container.

    Notify the container of progress in the asynchronous download, including when the user can start to interact with a page, and when the download is complete. The container can display progress (such as percent complete) to the user.

  • How controls are registered on the client computer.

For more information about the new features of ActiveX controls and how you can make them work well on the Internet, see the ActiveX Software Development Kit (SDK) documentation.

See Also   Internet: Where Is..., Internet First Steps: ActiveX Controls