COM PHP

The component object model (COM) is a framework that allows sharing of executable modules without recompiling. If you have used Windows for any time at all, you are aware of dynamic-link libraries (DLLs), collections of functions a program can load on demand. Many programs can share a DLL, which goes a long way toward the principle of reuse. Unfortunately, DLLs that work well with some programming languages don't work at all with others. COM seeks to solve this problem. COM objects are accessible by C++, Visual Basic, Java, and PHP.

To use a COM object in PHP, you first load it with com_load. After that, you can invoke methods with com_invoke, and you get and set properties with com_propget and com_propset. Zeev Suraski added COM support to PHP.

com_get
Use com_get as an alias for com_propget.

value com_invoke(integer object, string method, argument, argument, ...)
The com_invoke function invokes a method on a COM object. You must specify a valid object resource identifier and the name of a method. If the method takes arguments, you list them after the method name.

integer com_load(string module, string server)
The com_load function loads the named COM object and returns a resource identifier to be used by the other COM functions. The optional server argument allows you to specify a remote server. FALSE is returned when the load fails. The module is named by its ProgID.

<?
//load object
if(!($beeper = com_load("BeepCntMod.BeepCnt")))
{
print("Could not load object!<BR> ");
exit();
}
//print current value of count
print(com_propget($beeper, "Count") . "<BR> ");
//change count
com_propset($beeper, "Count", 6);
//make a beep
com_invoke($beeper, "Beep");
?>

value com_propget(integer object, string property)
The com_propget function returns the value of a property on a COM object.

com_propput
Use com_propput as an alias for com_propset.

boolean com_propset(integer object, string property, value data)
The com_propset function changes the value of a property.

com_set
Use com_set as an alias for com_propset.

« Previous Topics
Aspell
Apache
Database Abstraction Layers
Next Topics »
Gettext
Imap
Java

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

PHP Topics