Retrieves a running object that has been registered with OLE.

OutputVar := ComObjActive(CLSID)

Function Example: aOut := ComObjActive("Outlook.Application")



The name of the variable in which to store a COM wrapper object which can be used with object syntax.

Default behaviour. AddRef is called automatically for IUnknown and IDispatch pointers, so the caller should use ObjRelease to release their copy of the pointer if appropriate.

As the default behaviour may be changing in a future release, it is recommended to always set Flags to 1 when wrapping an interface pointer, and call ObjAddRef if needed.


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

ComObject, ComObjCreate, ComObjGet, ComObjConnect, ComObjError, ComObjFlags, ObjAddRef/ObjRelease, ComObjQuery, GetActiveObject (MSDN)


; Displays the active document in Microsoft Word, if it is running.
word := ComObjActive("Word.Application")
if !word
    MsgBox Word isn't open.
    MsgBox % word.ActiveDocument.FullName