com_get_active_object
com_get_active_object
Returns a handle to an already running instance of a COM object
variant **com_get_active_object** string $prog_id $codepage
is similar to creating a new
instance of a object, except that it will
only return an object to your script if the object is already running.
OLE applications use something known as the "" to
allow well-known applications to be launched only once; this function
exposes the COM library function GetActiveObject() to get a handle on a
running instance.
com_get_active_object``Running Object Table
prog_id
must be either the ProgID or CLSID for
the object that you want to access (for example
).
prog_id``Word.Application
codepageActs in precisely the same way that it does for the class.
If the requested object is running, it will be returned to your script just like any other COM object.
There are a variety of reasons why this function might fail, the most
common being that the object is not already running. In that situation,
the exception error code will be ;
you can use the method of the exception object
to check the exception code.
MK_E_UNAVAILABLE``getCode
Waarschuwing: > Using in a web server context is not always a smart idea. Most COM/OLE applications are not designed to handle more than one client concurrently, even (or especially!) Microsoft Office. You should read for more information on the general issues involved.
com_get_active_objectConsiderations for Server-Side Automation of Office