Home > Products > Authorware > Support > Using ActiveX controls
Macromedia Authorware Support Center - Using ActiveX controls
Installing and registering the ActiveX controls

You must install and register any ActiveX controls your piece uses.

Most ActiveX controls consist of a single file (OCX, DLL, or CAB) that simplifies installation since you need to copy only that file to the user's hard drive. Some vendors distribute CAB files along with an INF file that contains installation information the ActiveX control uses to install itself. A few ActiveX controls consist of several files and require a separate installation routine provided by the control vendor.

Once a control is on the user's hard disk, you need to register the control in the Windows registry.

Most ActiveX controls have a self-registering function built into them that you can trigger through two methods:

Dynamically from within an Authorware piece using the URL field
By using the scripting functions that are part of the ActiveX Xtra
The second method is generally better, since it offers greater control over the installation process. But it shifts the management of the process to you.

Dynamic installation and registration
You can download and register an ActiveX control dynamically from within an Authorware piece through the sprite Xtra icon. During runtime, when the flow reaches the sprite Xtra icon, Authorware downloads and registers the control.

To dynamically download a control:

1 Open the Properties dialog box for the sprite Xtra icon containing the control.
2 Click the URL button.

The ActiveX Control URL dialog box appears.

3 Enter the complete URL of the control to download in the Download from URL field.

The URL must match the URL of the ActiveX control exactly. If it doesn't, the download fails. You can also list just the file name if it's in the search path of your Authorware piece.

4 Enter a version number in the Version to field.

To use the latest version of the control, keep the default -1, -1, -1, -1 for the version number. The version number must match the version exactly. If it doesn't, the download fails.

5 Click OK.
Installation and registration using the ActiveX Xtra
The ActiveX Xtra provides scripting functions that let you control ActiveX features such as security, downloading, and registration. While using this method requires more effort, it results in greater control over the process.

The basic steps for creating an installation and registration script are given below. Read them, then look at the sample scripts for Installing from the Internetand Installing from a local source .

To create a script:

1 Check for ActiveX support.

Before you can download or register an ActiveX control, the system must have the appropriate ActiveX system files. Use the ActiveXInstalled function to check for ActiveX support. If support doesn't exist, you can use the Windows MessageBox function (located in Winapi.u32) to display a message to the user.

2 Check to see if the control is already registered.

The Windows registry tracks ActiveX controls by a 32 digit ClassID number. You can get the ClassID for a control by clicking Options and URL from the Sprite Icon Properties dialog box.

The ActiveXControlQuery function checks for the existence of a particular ClassID. If the function finds the ClassID, it returns -1 regardless of the version of the installed control. It's possible that the ClassID it finds belongs to an older version of the control. Old versions of a control may produce unpredictable results if there's a significant difference between versions of the control.

You can use the ActiveXControlDownload function or the ActiveXControlRegister function to register a control regardless of its version number.

3 Check the security settings.

Microsoft has a security system for ActiveX that can prevent the download of controls without the permission of the user. Use the ActiveXDownloadSetting and ActiveXSecuritySetting functions to check if you can download a control. The user must enable ActiveX downloading and set the Security Method to Medium or None. The user can modify the security settings through the Security tab of the Windows Internet Properties dialog box or you can display an ActiveX security dialog box for the user with the ActiveXSecurityDialog function.

Since the ActiveXControlRegister function doesn't download anything to the user's system, the security settings have no effect.

4 Register the control.

To deliver an ActiveX control from the Internet, use the ActiveXControlDownload function. ActiveXControlDownload copies the file from the URL to the user's hard drive (usually to the occache folder within the Windows folder) and registers the control.

To deliver an ActiveX control from a local source (for example, from a CD-ROM) you can also use ActiveXControlDownload , but the control must be contained in a CAB file. If your control isn't in a CAB file, you can use the ActiveXControlRegister function to register it. If you don't copy the control to the user's hard drive, you should unregister the control when you're done using ActiveXControlUnregister .

To Table of Contents Back to previous page Forward to next page