Contents Index Topic Contents | ||
Previous Topic: Palette Management for ActiveX Objects Next Topic: ActiveX Control Containers |
Registering an ActiveX Object as the Player for a Media Type
This topic describes how to register an ActiveX object as the viewer or player for a particular media type (MIME). This registration is essential for Microsoft® Internet Explorer to launch the correct player when interpreting the standard HTML A HREF tag or the Netscape-introduced EMBED tag. Without this registration, it is impossible to guess what application to use to display or play an unknown media file. The registration process associates an ActiveX object with a given MIME type or file-name extension so that Internet Explorer or any other ActiveX control container can launch the correct player for files of that type. Internet Explorer first tries to find a match for the correct media type; if that is not possible, it uses the file-name extension.
What Information Needs To Be Registered
An ActiveX object has four pieces of identifying information:
- The class identifier (CLSID) of the object. This is a globally unique identifier (GUID). The examples below use this CLSID:
{01234567-89AB-CDEF-0123-456789ABCDEF}- The ProgId of the object. This is a textual program identifier. The examples use FooCorp.BarControl.
- The MIME type for media types the object understands. Note that not all ActiveX objects are viewers or players for media types, so not every object needs to be associated with a MIME type. The examples use the MIME type application/foobar.
- The file extension for media types the object understands. Note that not all ActiveX objects are viewers or players for media types, so not every object needs to be associated with a file extension. The examples use the extension .foo.
Step 1: Registering the CLSID for the ActiveX Object
All ActiveX/COM objects must be entered in the registry so COM (Component Object Model) knows how to instantiate the object servers from the appropriate executable file. For full details on this registration process, see the COM Specification or OLE Reference (in the Platform SDK). A simple in-proc server would enter information such as the following in the registry.
HKEY_CLASSES_ROOT\CLSID\ {01234567-89AB-CDEF-0123-456789ABCDEF}\ InProcServer32 DLL File location ProgId FooCorp.BarControl ......To see an example, run Regedit.exe and look under HKEY_CLASSES_ROOT\CLSID.
Note For an ActiveX control to act as a full-frame viewer (for HTML A HREF tags) or as an embedded viewer (for EMBED tags), it is also necessary to include the CONTROL keyword in the registry settings for the control.
HKEY_CLASSES_ROOT\CLSID\ {01234567-89AB-CDEF-0123-456789ABCDEF}\ Control (value not set)It is also possible to register an ActiveX control as a full-frame viewer so it is used as the viewer/player when following A HREF links to a particular media type. To mark an ActiveX control as capable of full-frame display, use the following registry setting:
HKEY_CLASSES_ROOT\CLSID\ {01234567-89AB-CDEF-0123-456789ABCDEF}\ EnableFullPane\ .fooNote A requirement of this EnableFullPane registration process is to register the control as the viewer for the .foo file extension as described below.
Step 2: Associating the Object's CLSID with a ProgId
To associate a given ActiveX object with data types, it is first necessary to associate the object CLSID with a ProgId (program identifier). This is explained fully in the COM Specification or OLE Reference pages (Platform SDK), and is illustrated in the following simple example for defining the new ProgId, FooCorp.BarControl.
HKEY_CLASSES_ROOT\ FooCorp.BarControl\ CLSID {01234567-89AB-CDEF-0123-456789ABCDEF}Also under the ProgId key it is possible to register shell commands to be used to edit or open files for this ProgId, as in the following example:
HKEY_CLASSES_ROOT\FooCorp.BarControl\ Shell\Open\ Command c:\Program Files\foobar.exe %1Step 3: Associating the Object with a MIME Type
It is possible to associate an ActiveX object as a viewer for various media types. The following keys must be entered in the registry to associate a given ActiveX object with a given media type, application/foobar.
HKEY_CLASSES_ROOT\ MIME\Database\Content Type\ application/foobar\ Extension .foo CLSID {01234567-89AB-CDEF-0123-456789ABCDEF}Note Neither the Extension nor the CLSID key is necessary. One key associates the MIME type with a file extension; the other associates it with the CLSID of an ActiveX object.
Step 4: Associating the File Extension with a ProgId and Optionally with a MIME Type
If an ActiveX control container such as Microsoft Internet Explorer does not have a (server-provided) MIME type to choose a viewer for a new data type, the data file-name extension is used to find the appropriate ActiveX object to understand the new media format. If the file-name extension is associated with a MIME type, the MIME-CLSID mapping is used to pick the object. Otherwise, the extension-ProgId mapping is used. The example below shows how to associate a three-letter file extension with a MIME type and a ProgId, although the MIME association is optional.
HKEY_CLASSES_ROOT\ .foo\ (Default) FooCorp.BarControl Content Type application/foobar
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.