ContentsIndexPreviousNext

6.10.1 Adding ActiveX Controls or OLE Objects to Your COBOL Program

You can add ActiveX controls and OLE objects to your ACUCOBOL-GT program using the AcuBench integrated development environment or using a utility program called "AXDEFGEN." (AXDEFGEN is provided on the ACUCOBOL-GT installation media for your convenience. Refer to section 3.7 of this book for details.) Refer to the AcuBench User's Guide for more information about adding ActiveX controls using AcuBench.

The role of AXDEFGEN is to locate the names of ActiveX controls and OLE objects currently registered on the system and generate a COBOL copybook for the control or object that you select. This copybook is used by the ACUCOBOL-GT compiler for syntax and parameter type checking as well as efficient code generation.

The copybook contains a SPECIAL-NAMES CLASS definition for the ActiveX control/OLE object. For this reason, after generating the copybook with AXDEFGEN, you must copy the copybook into the COBOL program's SPECIAL-NAMES paragraph in the ENVIRONMENT DIVISION/CONFIGURATION SECTION. Please note that the SPECIAL-NAMES paragraph must end with a period. However, the copybook generated by AXDEFGEN does not end with a period. This is so other definitions can be made in the SPECIAL-NAMES paragraph after the COPY statement which copies this copybook. To complete the paragraph, you must add a period.

The SPECIAL-NAMES CLASS definitions in the copybook generated by AXDEFGEN contain all of the information the compiler needs to know about the ActiveX control or OLE object. This eliminates the need for the compiler to read the system registry or instantiate the ActiveX control during compilation of the COBOL program. This also allows the COBOL program to be compiled later on UNIX or VMS machine or on a Windows machine that does not have the particular ActiveX control registered.

In order for the control to function in your COBOL program, you must add it to your program. Typically, you modify the SCREEN SECTION to include the name of the control's primary interface. This name can be determined by looking at the copybook section "***Primary Interface***." Occasionally, you may want to create the control in your PROCEDURE DIVISION using the DISPLAY statement.

More:

To add an ActiveX control or OLE object to your ACUCOBOL-GT program