📄 function.com-get-active-object.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Returns a handle to an already running instance of a COM object</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.com-event-sink.html">com_event_sink</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.com-get.html">com_get</a></div> <div class="up"><a href="ref.com.html">COM Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.com-get-active-object" class="refentry"> <div class="refnamediv"> <h1 class="refname">com_get_active_object</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">com_get_active_object</span> — <span class="dc-title">Returns a handle to an already running instance of a COM object</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="class.variant.html" class="type variant">variant</a></span> <span class="methodname"><b><b>com_get_active_object</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$progid</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$code_page</tt></span> ] )</div> <p class="para rdfs-comment"> <b>com_get_active_object()</b> is similar to creating a new instance of a <a href="class.com.html" class="xref">COM</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 Running Object Table 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. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">progid</tt></i></span> <dd> <p class="para"> <i><tt class="parameter">progid</tt></i> must be either the ProgID or CLSID for the object that you want to access (for example <i>Word.Application</i>). </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">code_page</tt></i></span> <dd> <p class="para"> Acts in precisely the same way that it does for the <a href="class.com.html" class="xref">COM</a> class. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> If the requested object is running, it will be returned to your script just like any other COM object. </p> </div> <div class="refsect1 errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> 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 <b><tt>MK_E_UNAVAILABLE</tt></b>; you can use the <i>getCode</i> method of the exception object to check the exception code. </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <div class="warning"><b class="warning">Warning</b> <p class="para"> Using <b>com_get_active_object()</b> 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 <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757" class="link external">» Considerations for Server-Side Automation of Office</a> for more information on the general issues involved. </p> </div> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.com-event-sink.html">com_event_sink</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.com-get.html">com_get</a></div> <div class="up"><a href="ref.com.html">COM Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -