ComObjActive

Linux port: COM is implemented over the D-Bus desktop bus: ComObject("org.freedesktop.DBus") creates a proxy for a bus service, method calls and property access map to D-Bus calls, and ComValue wraps typed values. Windows COM interfaces (IUnknown/IDispatch pointers, SafeArrays) do not exist on Linux.

Retrieves a registered COM object.

ComObj := ComObjActive(CLSID)

Parameters

CLSID

Type: String

CLSID or human-readable Prog ID of the COM object to retrieve.

Return Value

Type: ComObject

This function returns a new COM wrapper object with the variant type VT_DISPATCH (9).

Error Handling

An exception is thrown on failure.

ComValue, ComObject, ComObjGet, ComObjConnect, ComObjFlags, ObjAddRef/ObjRelease, ComObjQuery, GetActiveObject (Microsoft Docs)

Examples

Displays the active document in Microsoft Word, if it is running. For details about the COM object and its properties used below, see Word.Application object (Microsoft Docs).

try word := ComObjActive("Word.Application")
if not IsSet(word)
    MsgBox "Word isn't open."
else
    MsgBox word.ActiveDocument.FullName