note 36475 modified in ref.com by vincent
| From: | vincent@php.net | Date: | Sat, 11 Oct 2003 07:31:57 +0000 |
| Subject: | note 36475 modified in ref.com by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58220@lists.php.net to get a copy of this message | ||
-- 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...
--was--
-- 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");
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...
http://www.php.net/manual/en/ref.com.php