ComObjActive()

Retrieves a running object that has been registered with OLE.

OutputVar := ComObjActive(CLSID)

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

Parameters

OutputVar

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

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

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

Example

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