Skip to content

ComActiveObject - cDesktop

Returns Variant containing an IUnknown* to an active COM object matching the passed program ID

Type: Function
Return Data Type: Variant

Parameters

Parameter Type Description
sProgId String COM object program ID string

Syntax

Function ComActiveObject String sProgId Returns Variant

Call Example

Get ComActiveObject sProgId to VariantVariable

Description

ComActiveObject returns a Variant containing an IUnknown* to an active COM object matching the program ID passed in the sProgID parameter. The function searches the system running object table (ROT).

You can use this function to test if the ROT has a active object for a given program ID as shown in the following example:

Procedure Test
    String sProgId
    Variant vComObject

    // initialize the Variant to null com Object
    Move (NullComObject()) To vComObject
    Move "{83B0E442-D4EE-11D4-BEDF-BAB7F1EEA455}" To sProgId

    Get ComActiveObject of Desktop sProgId To vComObject

    If (IsNullComObject(vComObject)) ;
        Showln "Program ID Not in ROT"
    Else ;
        Showln "Program ID found in ROT"
End_Procedure  // Test

Note that this is a function of the cDestkop class and therefore of the Desktop object. You can send this message directly to the desktop object (as shown in the above example) or you could just send the message to your current object and allow the message to be resolved via delegation

See Also

psProgID | AttachActiveObject

Return Value

Returns a Variant containing an IUnknown* to an active COM object matching the program ID passed in the sProgID parameter.