Microsoft ActiveX Contents

## 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:

- OLE Controls - COM Objects for the Internet This document describes extensions for OLE Controls to help them work well in the Internet environment (that is, when inserted in HTML pages). The document also describes how existing OLE Controls should be modified to work better with ActiveX-enabled containers.
- OLE Controls '96 This document describes the ActiveX enhancements to OLE Controls, including windowless, transparent, and irregularly shaped controls, plus performance enhancements.
- OLE Control and Control Container Guidelines This document specifies guidelines for creating ActiveX Controls and control containers.
- Registering an ActiveX Object as the Player for a Media Type This document describes how to register an ActiveX object as the "viewer" or "player" for a particular media type (MIME). This registration is essential in order for Microsoft Internet Explorer to launch the correct player when interpreting the standard HTML <A HREF> tag or the Netscape-introduced <EMBED> tag.
- Internet Component Download This document describes a system service for downloading and installing component code from the Internet. Applications such as Microsoft Internet Explorer use this service to automatically download and install COM objects from code repositories on the Internet. This document explains how code authors should prepare their components for automatic download. It also describes the application programming interface (API) for the component download mechanism.
- Safety API Reference Microsoft Internet Explorer allows Web authors to add code and interactivity to their HTML pages. With that greater power often comes greater risk, in the form of malicious code. This document describes the potential security hazards of allowing trusted code in ActiveX Controls to be accessed from untrusted scripts and to be initialized from untrusted data, and discusses how controls can be marked as safe for these actions so the user will not receive warning dialogs.
- Palettes and ActiveX Objects This document describes palette management for ActiveX objects. The palette management rules described allow multiple ActiveX Controls inside a form on an HTML page to display correctly, while leaving enough flexibility to allow each one to request control of the system palette to display using a custom color scheme.
- Licensing ActiveX Controls This document explains the mechanism for licensing of ActiveX Controls, so that control authors can sell design-time licenses to controls that allow Web authors to distribute the controls on their pages for free run-time use.

### 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