Distributing Applications Containing ActiveX Controls

To distribute your application, you need the object files and the resources they use. If you have added ActiveX controls to your application, you need to distribute files associated with the ActiveX controls along with the bitmap, ".wav", XFD, and configuration files required by your application. In addition, you need to modify your installation program to install and register the controls on the end-user's machine. Typically, you can accomplish this by copying the ActiveX control files (at least a ".ocx" or ".dll" file) to the directory where your application will be installed on the user's hard disk and calling the following command from your install shield script or batch file:

regsvr32 <ocx or dll name>

The "regsvr32.exe" file is normally located in the user's \windows\system directory. It is also included on the ACUCOBOL-GT Windows installation CD. Do not assume that it is in the user's search path or that it is pre-installed on Windows 98 and Windows NT 4.

Note: We recommend that you test your component installation by using the declaratives section to catch exceptions when creating an instance of an ActiveX control. See C$EXCEPINFO for details. In addition, note that "regsvr32" can be used to unregister a control as well as register it. This may be useful if you want to test whether or not your installation script is properly registering the control. When you type "regsvr32" with no command-line options, a list of available options is displayed.

For your convenience, several Microsoft controls have been included with the ACUCOBOL-GT Windows runtime. You can use these controls in your program and redistribute them to your end users as needed. The runtime checks out the license key automatically so you don't have to provide one. These controls include:

The ".ocx" files for these controls reside in the \ms\ocx subdirectory of the ACUCOBOL-GT installation CD for Windows. There, you will find documents called "list.txt" and "procedure.txt", which describe how to install and register the Microsoft components onto the target machine(s). Note that for network installations, you must install the components on each workstation that will use the software (including thin client terminals). It is not sufficient to install the components on the server. For information on the controls themselves, refer to Microsoft's Controls Reference on msdn.microsoft.com.

Of course, you can use any ActiveX control in your ACUCOBOL-GT application, not just the ones that we provide on disk.

Complex controls may have more complicated installation and registration procedures. If this is the case, control vendors typically provide instructions on distributing their controls. Look for instructions in the form of "readme" files or online help files in the directory where your control is stored. You can also refer to a vendor's Web site for instructions.

When an ActiveX control requires a license, the distributor of the control provides a license key. This license key is a text string. To use a license with an ActiveX control, you set the value of the LICENSE-KEY property for the control to this license key, thereby embedding this license key in your COBOL program. Note that an ActiveX control is often delivered with two keys–one for development and one for distribution. If this is the case, the ActiveX vendor will notify you of this fact.

Once you've set the LICENSE-KEY property, when your COBOL program creates an instance of the control, the license key is passed to the ActiveX control for verification. Please note that if the license key is WideChar (WCHAR) (Doublebyte) such as "0x0067 0x01a2 0x00dd 0x0134 0x0167," you must take some additional steps to ensure that the license code is passed. If the control's license is missing or invalid, the following message displays:

Class is not licensed for use.
COBOL error at xxxxx in xxxxx.

refer to ACUCOBOL-GT User Interface Programming > Control Type Reference > ActiveX > Special Properties for more information on using the LICENSE-KEY property and passing WideChar keys.