[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-windows
Subject:    [PHP-WIN] COM and reference or smart pointers to com interface
From:       212.67.178.138
Date:       2003-03-31 16:17:56
[Download RAW message or body]

Hi, I am writing a php application to use a com object that is defined in my
OS, but I have difficulties getting a (smart)pointer from another
com-object.

Here is the code (untill the error):
******************************************************************
$ConnectionObj = new COM("Falcon.ConnectionObject") or die("Unable to
instanciate ConnectionObject"); //First COM-object !!!!
print "Loaded ConnectionObject\n";
$GroupDataObj = new COM("Falcon.GroupData") or die("Unable to instanciate
GroupDataObject"); //Second COM-object!!!
print "Loaded GroupDataObject\n";

$devOpenErr = $ConnectionObj->Open2("FalconEdi.Pei16Edi.1","COM1");//);
//Get a connection to some thing :-)

$result = $GroupDataObj->Connection($ConnectionObj);  //Here is the error
******************************************************************

At this last line I get the error Invoke() failed:exception occured. I think
this is because I don't know how to get a smartpointer to that
ConnectionObject.  Because a parameter in the GroupDataObj must be a pointer
to the first COM-object and this is done throught this function
(GroupDataObj->Connection) which takes a pointer to that first com-object.
The function GroupDataObj->Connection is defined as follows:
******************************************************************
HRESULT IGroupDataTransfer::Connection (  [in] IConnection * newVal )
******************************************************************

with "IConnection" the Interface "Falcon.ConnectionObject" like in my php
code above.

In C++, I would have done that last line as follows:
******************************************************************
HRESULT hr = GroupdataObj->Connection (IConnectionPtr(IConnectionObj));
******************************************************************

But in C++ the headers are used and this is what I found for the definition
of IConnectionPtr:
******************************************************************
#if defined(__cplusplus) && defined(_MSC_VER) &&
defined(_COM_SMARTPTR_TYPEDEF)
_COM_SMARTPTR_TYPEDEF(IConnection, __uuidof(IConnection));
******************************************************************

Anybody knows ho to do that in PHP ?
Are these variables I created abov, "$ConnectionObj"  and
"$GroupDataObj" pointers or php-com-structures or both ? If not the first
how can you get a pointer to it then ?

Thanks





-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic