mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-21 19:38:56 +00:00

# win32 users, you all owe me beer ;) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@157837 c90b9560-bf6c-de11-be94-00142212c4b1
107 lines
3 KiB
XML
107 lines
3 KiB
XML
<?xml version='1.0' encoding='iso-8859-1'?>
|
|
<!-- $Revision: 1.1 $ -->
|
|
<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. -->
|
|
<refentry id="function.com-event-sink">
|
|
<refnamediv>
|
|
<refname>com_event_sink</refname>
|
|
<refpurpose>
|
|
Connect events from a COM object to a PHP object
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>com_event_sink</methodname>
|
|
<methodparam><type>object</type><parameter>comobject</parameter></methodparam>
|
|
<methodparam><type>object</type><parameter>sinkobject</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>sinkinterface</parameter></methodparam>
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
Instructs COM to sink events generated by
|
|
<parameter>comobject</parameter> into the PHP object
|
|
<parameter>sinkobject</parameter>. PHP will attempt to use the default
|
|
dispinterface type specified by the typelibrary associated with
|
|
<parameter>comobject</parameter>, but you may override this choice by
|
|
setting <parameter>sinkinterface</parameter> to the name of the
|
|
dispinterface that you want to use.
|
|
</para>
|
|
|
|
<para>
|
|
<parameter>sinkobject</parameter> should be an instance of a class with
|
|
methods named after those of the desired dispinterface; you may use
|
|
<function>com_print_typeinfo</function> to help generate a template class
|
|
for this purpose.
|
|
</para>
|
|
|
|
<para>
|
|
Be careful how you use this feature; if you are doing something similar
|
|
to the example below, then it doesn't really make sense to run it in a
|
|
web server context.
|
|
</para>
|
|
|
|
<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");
|
|
// note that you don't need the & for PHP 5!
|
|
$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>
|
|
|
|
<para>
|
|
See also <function>com_print_typeinfo</function>,
|
|
<function>com_message_pump</function>.
|
|
</para>
|
|
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|