From: Graham Ford Date: 2006-06-09T01:58:15+09:00 Subject: win32ole, integer pointer parameter ------_=_NextPart_001_01C68B1C.7E762A3A Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I am trying to call a COM DLL with Win32OLE, but I am running into an=20 issue with passing an argument to the method call. The following works=20 in Perl: =20 -- begin Perl =20 use Win32::OLE; use Win32::OLE::Variant; =20 my $engine =3D Win32::OLE->new('X.X') or die 'Cannot load engine DLL:=20 '.$!; my $system =3D 'C:\path\to\dir'; my $mode =3D 0; my $retVal =3D Variant(VT_I4|VT_BYREF, 0); my $rc; =20 $rc =3D $engine->Execute($system,$mode,$retVal); print "Return Val: ".$retVal; =20 -- end Perl =20 In ruby I think it should look like this: =20 -- begin Ruby =20 require 'win32ole' engine =3D WIN32OLE.new('X.X') =20 retVal =3D 1 rc =3D 1 =20 rc =3D engine.Execute('C:\path\to\dir',0,retVal) =20 print "Return Code: ",retVal =20 -- end Ruby =20 When I run the ruby code, the DLL executes and processes the directory,=20 but I need to be able to get back the return value. Unlike in Perl,=20 ruby doesn't seem to be able to generate a variant object to be passed=20 to the method call. The DLL expects an integer pointer for the third=20 argument, COM signature VT_I4|VT_BYREF, but I'm at a loss as to how to=20 properly pass this so I can retrieve the value after execution. =20 I've also tried olegen.rb to generate a ruby class for the DLL, but this seems to have the same exact problem. =20 Thanks, Graham =20 ------_=_NextPart_001_01C68B1C.7E762A3A--