Services webmasters
Partenaires
Jeux concours gratuits
 
Is it possible to get a running instance of a component ?
<<<
Is there a way to handle an event sent from COM object ? I'm having problems when trying to invoke a method of a COM object which exposes more than one interface. What can I do ?
>>>

10.9 PHP and COM
10 FAQ : Foire Aux Questions
 Manuel PHP

I have built a DLL to calculate something. Is there any way to run this DLL under PHP ?
What does 'Unsupported variant type: xxxx (0xxxxx)' mean ?
Is it possible manipulate visual objects in PHP ?
Can I store a COM object in a session ?
How can I trap COM errors ?
Can I generate DLL files from PHP scripts like i can in Perl ?
What does 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' mean ?
How can I run COM object from remote server ?
I get 'DCOM is disabled in C:\path...\scriptname.php on line 6', what can I do ?
Is it possible to load/manipulate an ActiveX object in a page with PHP ?
Is it possible to get a running instance of a component ?
-> Is there a way to handle an event sent from COM object ?
I'm having problems when trying to invoke a method of a COM object which exposes more than one interface. What can I do ?
So PHP works with COM, how about COM+ ?
If PHP can manipulate COM objects, can we imagine to use MTS to manage components resources, in conjunction with PHP ?

10.9.12 Is there a way to handle an event sent from COM object ?

Starting in PHP 4.3.0, you can define an event sink and bind it as shown in the example below. You can use com_print_typeinfo to have PHP generate a skeleton for the event sink class.
COM event sink example

<?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;
?>

<< Is there a way to handle an event sent from COM object ? >>
Is it possible to get a running instance of a component ? PHP and COM I'm having problems when trying to invoke a method of a COM object which exposes more than one interface. What can I do ?
Services webmasters
Les manuels
 
CoursPHP.com - Reproduction interdite -