Bharucha, Thank you for your help. What you meant is that only Win32::API is enough to do the job? Win32::OLE is not necessary?
As I know, Win32::API can import and call functions from Win32's Dynamic Link Libraries (DLL), I was wondering if it can import and call functions from standalone executables. Do you have any idea about that? Which is a best way to call functions in a standalone executable? Thanks in advance. On 6/6/05, Bharucha, Nikhil <[EMAIL PROTECTED]> wrote: > I have code using Jan's OLE.pm and it works a-ok. However, what you > execute must implement the iDispatch or automation interface. You may > want to use API.pm if you just want to suck those functions into your > Perl code and execute like a sub. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of J > aperlh > Sent: Sunday, June 05, 2005 11:34 PM > To: [email protected] > Subject: A question about Win32::OLE. Really need you help!!! > > A question about Win32::OLE. Really need you help!!! > > > There is a standalone executable written in C/C++. > What I am going to do is to write a perl script to call several > functions available in this executable. > > > >From the following article, I thought the job is very easy. > #10 - Win32::OLE by Jan Dubois > The Perl Journal #10 - Win32::OLE by Jan Dubois > Just considering the executable as an OLE server, and the PERL script > as an OLE controller should be OK. > > > When I call the functions, most of them work well, for example: > > my $app = Win32::OLE->new('AAA.BBB', 'Quit'); > > # call the function: > # BOOL GetPathname(BSTR* Pathname) > > my $Pathname = Variant(VT_BSTR|VT_BYREF, ''); > my $ret = $app->GetPathname($Pathname); > > > But, for the following function, I don't know that I should pass to > this funtion. > Array reference or something else? > > # BOOL GetValues(BSTR* names, double* values, short > number_of_names); > > # (input) > # names: a list of names > # number_of_names: size of the array > # (output) > # values: a list of corresponding values, > > > I tried to pass array references to it, and something else, like the > following, > both failed with an error: Type Mismatch... > > my $names = Variant(VT_BSTR|VT_ARRAY, 3); > my $values = Variant(VT_R8|VT_ARRAY, 3); > > $names->Put( ['name1', 'name2', 'name3'] ); > $values->Put( [0, 0, 0] ) > > my $ret = GetValues($names, $values, 3); > > > Do you guys have and idea about that? > What shold I pass to this function? > Is there any other way to do the same thing? > > Any comments are appreciated. > > > BTW: > I know that if the OLE controller is in C language, things will be > easier, > Pass the first element of the array to this function should be OK. > > _______________________________________________ > ActivePerl mailing list > [email protected] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
