wez Mon May 3 11:04:52 2004 EDT
Modified files: /phpdoc/en/faq com.xml Log: Update the COM FAQ. http://cvs.php.net/diff.php/phpdoc/en/faq/com.xml?r1=1.11&r2=1.12&ty=u Index: phpdoc/en/faq/com.xml diff -u phpdoc/en/faq/com.xml:1.11 phpdoc/en/faq/com.xml:1.12 --- phpdoc/en/faq/com.xml:1.11 Sun Mar 21 11:53:08 2004 +++ phpdoc/en/faq/com.xml Mon May 3 11:04:52 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <chapter id="faq.com"> <title>PHP and COM</title> <titleabbrev>PHP and COM</titleabbrev> @@ -78,8 +78,12 @@ </question> <answer> <para> - Currently it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..), but we are - thinking of a way to implement this. + In PHP 5, the COM extension throws <literal>com_exception</literal> + exceptions, which you can catch and then inspect the <literal>code</literal> + member to determine what to do next. + </para> + <para> + In PHP 4 it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..). </para> </answer> </qandaentry> @@ -139,7 +143,7 @@ the COM constructor. </para> <para> - Make sure that you have set <literal>com.allow_dcom=true</literal> in your &php.ini;. + Make sure that you have set <xref linkend="ini.com.allow-dcom"/><literal>=&true;</literal> in your &php.ini;. </para> </answer> </qandaentry> @@ -152,7 +156,7 @@ </question> <answer> <para> - Edit your &php.ini; and set <literal>com.allow_dcom=true</literal>. + Edit your &php.ini; and set <xref linkend="ini.com.allow-dcom"/><literal>=&true;</literal>. </para> </answer> </qandaentry> @@ -205,44 +209,10 @@ </question> <answer> <para> - Starting in PHP 4.3.0, you can define an event sink and bind it as shown - in the example below. You can use <function>com_print_typeinfo</function> - to have PHP generate a skeleton for the event sink class. - - <example> - <title>COM event sink example</title> - <programlisting role="php"> -<![CDATA[ -<?php -class IEEventSinker { - var $terminated = false; - - function ProgressChange($progress, $progressmax) { - echo "Download progress: $progress / $progressmax\n"; - } - - function DocumentComplete(&$dom, $url) { - echo "Document $url complete\n"; - } - - function OnQuit() { - echo "Quit!\n"; - $this->terminated = true; - } -} -$ie = new COM("InternetExplorer.Application"); -$sink =& new IEEventSinker(); -com_event_sink($ie, $sink, "DWebBrowserEvents2"); -$ie->Visible = true; -$ie->Navigate("http://www.php.net"); -while(!$sink->terminated) { - com_message_pump(4000); -} -$ie = null; -?> -]]> - </programlisting> - </example> + You can define an event sink and bind it using + <function>com_event_sink</function>. You can use + <function>com_print_typeinfo</function> to have PHP generate a skeleton + for the event sink class. </para> </answer> </qandaentry>