Export (0) Print
Expand All
23 out of 29 rated this helpful - Rate this topic

How to Register an ActiveX Object as the Player for a Media Type

This topic describes how to register a Microsoft ActiveX object as the viewer or player for a particular media type (MIME). This registration is essential for Windows 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 for Internet Explorer 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:

  • Class identifier (CLSID) of the object. This is a 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 MyCompany.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/funMedia.
  • The file name 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 name extension. The examples use the extension .smp.

Step 1: Registering the CLSID for the ActiveX Object

All ActiveX/Component Object Model (COM) objects must be entered in the registry so COM 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 Windows Software Development Kit). 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
                    (Default) = DLL file location
               ProgID
                    (Default) = MyCompany.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

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}
               EnableFullPage
                    .smp
Note   A requirement of this EnableFullPage registration process is to register the control as the viewer for the .smp 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 (Windows Software Development Kit), and is illustrated in the following simple example for defining the new ProgId, MyCompany.BarControl.

HKEY_CLASSES_ROOT
     MyCompany.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
     MyCompany.BarControl
          Shell
               Open
                    Command
                         (Default) = c:\Program Files\Sample.exe %1

Step 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/funMedia.

HKEY_CLASSES_ROOT
     MIME
          Database
               Content Type
                    application/funMedia
                         Extension = .smp
                         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 name extension; the other associates it with the CLSID of an ActiveX object.

Step 4: Associating the File Name Extension with a ProgId and Optionally with a MIME Type

If an ActiveX control container such as 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 name extension with a MIME type and a ProgId, although the MIME association is optional.

HKEY_CLASSES_ROOT
     .smp
          (Default) = MyCompany.BarControl
          Content Type = application/funMedia

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.