#32170 [Opn->Fbk]: com_event_sink does not take default event interface
ID: 32170
Updated by: sniper@php.net
Reported By: jeanpierre dot vincent at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: COM related
Operating System: windows 2000, xp
PHP Version: 5.0.1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-03-09 11:48:01] jeanpierre dot vincent at gmail dot com
with this version we have a big regression,it does not solve the bug
and a simple example of catching DocumentComplete event of WebBrowser
does not work as before : it's not even called.
------------------------------------------------------------------------
[2005-03-04 10:00:12] derick@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
------------------------------------------------------------------------
[2005-03-03 12:14:01] jeanpierre dot vincent at gmail dot com
Description:
------------
the function com_event_sink is documented like this:
bool com_event_sink ( variant comobject, object sinkobject [, mixed
sinkinterface] ).
but the sinkinterface does not take value of the default com object
event interface so optional is useless because the developper must know
all default object event sink interface.
Reproduce code:
---------------
<?php
class IEEventSinker {
var $terminated = false;
// when all objects of page are loaded
function DocumentComplete(&$dom, $url) {
GLOBAL $ie;
$GLOBALS['elem']=$ie->document->getElementById('test');
if ($GLOBALS['elem']!=null)
{
com_event_sink($GLOBALS['elem'],$this /*,'HTMLAnchorEvents'*/);
}
}
// when closing browser
function OnQuit() {
echo "Quit!\n";
$this->terminated = true;
}
// when clicking in url
function onclick() {
echo "click!\n";
}
}
$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('c:\test.html');
while(!$sink->terminated) {
com_message_pump(4000);
}
$ie = null;
?>
/////////////////////////////////////////////////////////
c:\test.html
<html>
<body >
<A id='test' href='#'>test</A>
</body>
</html>
Expected result:
----------------
browser is launching, navigate on test.html file.
when we click to url test the message is to be written in the console
:
Click!
Actual result:
--------------
no message written.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32170&edit=1
Thread (5 messages)