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 NEW option with the LET or SET statement, or omit it to use an existing instance of a COM object. 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/END INTERFACE, ISNOTHING, ISOBJECT, OBJECT, OBJPTR, OBJRESULT, PROGID$, SET |
Example |
' Create a reference to the MSWORD object DIM oWord AS DISPATCH ' use late-binding IF OBJACTIVE("Word.Application") THEN ' Already active, use existing instance LET oWord = DISPATCH IN "Word.Application" ELSE ' No server active, create a new instance LET oWord = NEW DISPATCH IN "Word.Application" END IF
' Obtain a progid from a 38-byte GUID, and attempt to reference the object instance DIM A AS STRING A = "{000209FF-0000-0000-C000-000000000046}" A = PROGID$(GUID$(A)) ' A now contains "word.application.8" IF OBJACTIVE(A) THEN... |