OBJACTIVE function

Purpose

Return TRUE/FALSE as an indication of the running state of an initialized COM object (EXE based).

Syntax

lResult& = OBJACTIVE(progid$)

Remarks

OBJACTIVE can provide information that may prove useful in determining whether to use the NEWCOM or GETCOM options with the LET (with Objects) statement. OBJACTIVE may only be used on COM objects that are in EXE format, not DLL/OCX/etc.  In the latter case, OBJACTIVE returns FALSE (0).

progid$

The registered program ID string for the COM object. For example, "Word.Application.8", or a version-independent program ID such as "Word.Application". A valid program ID string can be obtained from a 16-byte class ID string using the PROGID$ function, or derived from a 38 character GUID string using PROGID$ and GUID$.

See also

DIM, CLSID$, GUID$, GUIDTXT$, INTERFACE (Direct), INTERFACE (IDBind), ISNOTHING, ISOBJECT, Just what is COM?, LET (with Objects), OBJECT, OBJPTR, OBJRESULT, PROGID$, What is a COM component?

Example

' Create a reference to the MSWORD object
LOCAL oWord AS IDISPATCH  ' use late-binding
LOCAL i     AS LONG

IF OBJACTIVE("Word.Application") THEN
  ' Word is already active, use the existing instance
  oWord = GETCOM "Word.Application"
ELSE
  ' Word is not active, create a new instance
  oWord = NEWCOM "Word.Application"
END IF
' Set MS Word to a normal visible state
i = 0
OBJECT LET oWord.WindowState = i
...