Page 1 of 1

Com support for Windows

Posted: Tue Apr 29, 2003 4:04 pm
by maxi
I'm using PHP 4.3.2 RC2 and Apache 1.3.7 on Windows NT Workstation 4.0.
I want to use some COM objects but I have some problems with those objects that implements an interfase in which it returns another com object.
For instance:

page1.php

<?php

$arbitrer = new COM("Arbitrer.1") or die("I can't create arbitrer");
$rc = $arbitrer->GetQueryServer( "", $queryServer );
if ( $rc != 0 ){
die("Error in function Arbitrer.GetQueryServer: {$rc}");
}

// I don't get any error here, I suppose everything was perfectly created.

//but when i try to use the next function:

$rc = $queryServer->GetFirstCategoryV($vName, $vDescription);

// i get a message error saying i can't call a member method in a non-object. I suppose $queryServer is null (in fact it is)

All this code it's working withs ASP and IIS and the same com objects, I'm trying to pass everything to php but I am experiencing a lots of troubles with COM and PHP.
Anyone have any idea what it's happening? :cry:

Posted: Wed Apr 30, 2003 2:24 pm
by volka
$rc = $arbitrer->GetQueryServer( "", $queryServer );
This method really only returns the HRESULT and the second argument is not defined as RETVAL?

Posted: Wed Apr 30, 2003 3:34 pm
by maxi
It's the interface:

[id(4), helpstring("method GetQueryServer")] HRESULT GetQueryServer
( [in] BSTR ServerName, [out] VARIANTARG * QueryServer
, [out, retval] long * ErrorCode);

Posted: Wed Apr 30, 2003 4:55 pm
by volka
the you might need something like

Code: Select all

$var = new VARIANT(); // maybe even VARIANT(NULL, VT_DISPATCH)
$rc = $arbitrer->GetQueryServer( "", &$var );

Posted: Fri May 02, 2003 9:06 am
by maxi
Thank you very much for your collaboration.
Any way, it didn't work. Neither with $var = new VARIANT() nor $var = new VARIANT(NULL, VT_DISPATCH).