Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

9.8.2 Receiving Objects Using the COBOL *COM Class

When you work with ActiveX controls created by other systems you need to handle object references using the *COM class. For convenience, the example below uses a PowerCOBOL object, but you will be using external ActiveX controls.

To handle the objects passed to events using the *COM class, you need to declare the class in the REPOSITORY paragraph of the ENVIRONMENT DIVISION as described in "Accessing Objects Using the COBOL *COM Class" above.

Then, in the event code insert a "USAGE OBJECT REFERENCE COM" item in the WORKING-STORAGE SECTION and delete "[Class-name]" from the default LINKAGE SECTION entry. For example, in the NodeClick event you would have:

  WORKING-STORAGE SECTION.
  01  COMPCMNODE   OBJECT REFERENCE  COM.
  LINKAGE SECTION.
  01  POW-PCMNODE  OBJECT REFERENCE.

To get a COM class object reference you convert the received object reference using the "POWERCONVTOCOM" sub-program:

      CALL "POWERCONVTOCOM" USING POW-PCMNODE RETURNING COMPCMNODE.

Note: You should clear COMNODE after you finish using the statement:

      SET COMNODE TO NULL.