</head> <body> <h1>ComObjError() <span class="ver">[AHK_L 53+]</span></h1> <p>Enables or disables notification of COM errors.</p> <pre class="Syntax">Enabled := <span class="func">ComObjError</span>(<span class="optional">Enable</span>)</pre> <h2 id="Parameters">Parâmetros</h2> <dl> <dt>Enable</dt> <dd><p>A boolean value (true or false). Optional.</p></dd> <dt>Enabled</dt> <dd><p><span class="ver">[v1.0.91+]:</span> Receives the setting which was in effect before the function was called.</p></dd> </dl> <h2 id="General_Remarks">Observações Gerais</h2> <p>Notification of COM errors is enabled by default.</p> <p>COM errors may be raised by <a href="ComObjCreate.htm">ComObjCreate()</a>, <a href="ComObjGet.htm">ComObjGet()</a>, <a href="ComObjActive.htm">ComObjActive()</a>, <a href="ComObjConnect.htm">ComObjConnect()</a>, <a href="ComObjQuery.htm">ComObjQuery()</a> (if an invalid pointer is detected) or by a method or property of a COM object. Raising a COM error causes one of the following outcomes:</p> <table class="info" id="factors"> <tr><th>Setting</th><th>Outcome</th></tr> <tr> <td>0 (disabled)</td> <td>The function, method or property returns a default value (typically an empty string), without showing an error dialog.</td> </tr> <tr> <td>1 (enabled)</td> <td> <p>If there is an active <a href="Try.htm">Try</a> block, an exception is thrown. Do contrário:</p> <p>An error dialog is shown, giving the user the option to continue the script. If the user chooses "Yes", the function, method or property returns a default value (typically an empty string) and the script continues. Otherwise, the script exits.</p> </td> </tr> </table> <p>After accessing a COM object, <a href="../Variables.htm#LastError">A_LastError</a> contains the HRESULT code returned by the COM object's <a href="http://msdn.microsoft.com/en-us/library/ms221479.aspx">IDispatch::Invoke</a> function. The script may consult A_LastError within a <a href="Catch.htm">Catch</a> block or after the method or property returns, provided that <code>ComObjError(false)</code> has been used or the user did not choose to exit the script.</p> <h2 id="Related">Tópicos relacionados</h2> <p><a href="ComObjCreate.htm">ComObjCreate()</a>, <a href="ComObjGet.htm">ComObjGet()</a>, <a href="ComObjActive.htm">ComObjActive()</a>, <a href="ComObjConnect.htm">ComObjConnect()</a>, <a href="ComObjQuery.htm">ComObjQuery()</a></p> </body> </html>