ActiveX Controls

An ActiveX control is an object that can be inserted universally in Web pages, Microsoft Visual Basic® applications, and other OLE-enabled documents and applications. The following documents describe various interfaces and functions that an ActiveX control should support:

The Steps to Enabling OLE Controls for the Internet

1. Make sure your control can download data from HTTP or FTP locations.

If your control needs to load data, pick one of three alternatives for loading this data from Internet locations. For full details, see the COM Objects for the Internet specification.

  1. Support the IPersistStream interface. When your control is inserted using the syntax <OBJECT DATA="foo.ods">, Internet Explorer will download this data and pass it to your control's IPersistStream interface.

    - OR -

  2. Support the IPersistPropertyBag interface. One or more of the parameters in this property bag will be the URL for data that you will have to load. Be sure to use the IBindHost interface when loading this data. Use IBindHost::CreateMoniker to create a URL moniker from the URL, and use IBindHost::MonikerBindToStorage to download from this moniker. This will ensure that your download status is displayed in the progress bar (although this is not implemented by IE3.0). Note: As an easy alternative, you can use the URLOpenStream APIs, which will automatically hook you into the IBindHost architecture correctly.

    - OR -

  3. Use a framework for building your control. One such framework can be found in the ActiveX SDK under samples\basectl. Microsoft Foundation Class Library (MFC) 4.2 will also support Internet download for controls.

2. Mark it as safe for scripting or for persistence, if appropriate.

Check the Safety API Reference to see how to decide if an object is safe for scripting and safe for persisting, and if so how to mark it as a safe object. If you do not do this, you will get warning messages every time your control is used on an HTML page.

3. Sign the code.

Be sure your final code is signed so that when your control is automatically code-downloaded, no trust warning messages are displayed. Note: If you are using a .cab file for component download, it is faster to sign the entire .cab file than each individual component. For details on how to sign code, check Signing with Microsoft Authenticode Technology in the ActiveX SDK. For more information on the Microsoft code-signing initiative, you can check http://www.microsoft.com/intdev/signcode.

4. Package your control for code download.

See the Internet Component Download specification. You can find simple examples in the Microsoft ActiveX Gallery. More samples will be added to the ActiveX SDK in the future.

© 1996 Microsoft Corporation