Com support for Windows

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maxi
Forum Newbie
Posts: 10
Joined: Tue Apr 29, 2003 3:46 pm
Location: Buenos Aires, Argentina

Com support for Windows

Post 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:
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

$rc = $arbitrer->GetQueryServer( "", $queryServer );
This method really only returns the HRESULT and the second argument is not defined as RETVAL?
maxi
Forum Newbie
Posts: 10
Joined: Tue Apr 29, 2003 3:46 pm
Location: Buenos Aires, Argentina

Post by maxi »

It's the interface:

[id(4), helpstring("method GetQueryServer")] HRESULT GetQueryServer
( [in] BSTR ServerName, [out] VARIANTARG * QueryServer
, [out, retval] long * ErrorCode);
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

the you might need something like

Code: Select all

$var = new VARIANT(); // maybe even VARIANT(NULL, VT_DISPATCH)
$rc = $arbitrer->GetQueryServer( "", &$var );
maxi
Forum Newbie
Posts: 10
Joined: Tue Apr 29, 2003 3:46 pm
Location: Buenos Aires, Argentina

Post 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).
Post Reply