Re: COM - accessing pointer variables
| From: | park | Date: | Thu, 20 Sep 2001 07:45:48 +0000 |
| Subject: | Re: COM - accessing pointer variables | ||
| References: | 1 2 3 4 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-9429@lists.php.net to get a copy of this message | ||
Well if I have a func like this ( im trying to get it to work with the
simplist case now )
HRESULT test( [ out, ref ] unsigned char *n );
I can call that from PERL like
use Win32::OLE;
use Win32::OLE::Variant;
$obj = Win32::OLE->new( "comobjectname" );
$n = Variant( VT_UI1 | VT_BYREF, 0 );
$obj->test( $n );
Unfortunatly I prefer PHP's sytax to perl's ( a LOT ) so I tried duplicating
that in PHP, and got
$obj = new COM( "comobjectname" );
$n = new VARIANT( 0, VT_UI1 | VT_BYREF );
$obj->test( $n );
I get a | Warning: Invoke() failed: Type mismatch in <filename> on line
<line>
I cant see what I'm doing wrong as it works in PERL and they both use the
same IDispath style of interface ?
Two, other points....
1. How do I release my COM object ?, I thought I'd have to use the IUnknown
interface's Release() func to decrease the ref-count. But can I call that
from a IDispatch interface ? If not how DO I release my object
2. Can I pass strings - I read in the php.dev archive an article saying that
array passing to COM wasnt implemented yet. Is it ?
Please help if you can
Park
"Alain Samoun" <alain@sonic.net> wrote in message
news:20010919121237.A9434@sonic.net...
> I'm not sure, but try:
> $str = new VARIANT($obj->Get_Version_Str() , VT_STR | VT_BYREF );
> or simply:
> $str = $obj->Get_Version_Str();
> Also, are you sure that release() is part of your object definition?
>
> > $obj->Release();
> Alain