The following program retrieves and displays the control that has the focus. Note that although ActiveControl is a property of the Form it is not accessed like other properties. You have to use the *COM class. Also notice that POW-NULL is used to set and test PowerCOBOL POW-COBJECT items, such as the ActiveControl property, while the OOCOBOL NULL object is used to set and test the *COM objects.
DATA DIVISION. WORKING-STORAGE SECTION. 01 COM-FORM OBJECT REFERENCE COM. 01 COM-ACT-CTL OBJECT REFERENCE COM. 01 CTL-NAME PIC X(14). PROCEDURE DIVISION. * OBJECT REFERENCE POW-COBJECT is compared with POW-NULL. IF "ActiveControl" OF POW-SELF = POW-NULL THEN DISPLAY "No control has the focus." EXIT PROGRAM ELSE CALL "POWERCONVTOCOM" USING POW-SELF RETURNING COM-FORM INVOKE COM-FORM "GET-ACTIVECONTROL" RETURNING COM-ACT-CTL * OBJECT REFERENCE COM is compared with NULL object. IF COM-ACT-CTL NOT = NULL THEN INVOKE COM-ACT-CTL "GET-NAME" RETURNING CTL-NAME DISPLAY CTL-NAME " has the focus." SET COM-ACT-CTL TO NULL ELSE DISPLAY "Error" END-IF SET COM-FORM TO NULL END-IF