note 36475 deleted from ref.com by danbrown
| From: | danbrown@php.net | Date: | Mon, 21 Dec 2009 17:14:04 +0000 |
| Subject: | note 36475 deleted from ref.com by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164226@lists.php.net to get a copy of this message | ||
Note Submitter: superzouz is at hotmail
----
-- Catching COM events --
Hello everyone.
Anyone who did VB + COM would know something is missing here: events!
Here's how to catch IE events using some undocumented functions:
----------
class ieSinker {
var $terminated = false;
function TitleChange($text) {
echo("title has changed: $test \n");
}
function OnQuit() {
echo "Quit!\n";
$this->terminated = true;
}
}
$ie = new COM("InternetExplorer.Application");
$ieSink =& new ieSinker();
com_event_sink($ie, $ieSink, "DWebBrowserEvents2");
$ie->navigate(' PATH TO YOUR HTML FILE GOES HERE! ');
$ie->visible = True;
while(!$ieSink->terminated) {
com_message_pump(10);
}
----------
Works perfect for me with php 4.3
You can find more info on the undocumented functions in the YACL documentation.
Note the "DWebBrowserEvents2" interface. You can find more information about these in the
microsoft platform SDK documentation, under "web development". Or maybe they have a
smaller web development SDK? I wasn't able to use any other interface, so what I do is send
messages from IE to the PHP script by changing the title of the html document with JavaScript.
By the way, I cant take credit for the above code, I stole it from some website of which I lost the
address.
Thats it... bye...