note 45038 added to ref.com
| From: | ferozzahid | Date: | Tue, 24 Aug 2004 07:06:03 +0000 |
| Subject: | note 45038 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79917@lists.php.net to get a copy of this message | ||
To pass a parameter by reference to a COM function, you need to pass VARIANT to it. Common data
types like integers and strings will not work for it.
As an example, calling a function that retrieves the name of a person will look like:
$Name = new VARIANT;
$comobj = new COM("MyCOMOBj.Component") or die("Couldn't create the COM
Component");
if(!$comobj->GetName($Name)) {
echo("Could not retrieve name");
}
else {
echo("The name retrieved is : " . $Name->value);
}
$Name->type will contain the type of the value stored in the VARIANT e.g. VT_BSTR.
Note For PHP 5:
Insted of '$Name->value', we can use only '$Name' for getting the value
stored in the VARIANT. To get the type of the value stored in the VARIANT, use
'variant_get_type($Name)'.
Feroz Zahid
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45038
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45038&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45038&report=yes
Search -- http://master.php.net/manage/user-notes.php