Re: Help on Win32 API




"jis" <jismagic@xxxxxxxxx> wrote in message news:1182381020.613445.86000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
..
..
i tried like

use Win32::API;
my $function = Win32::API->new(
'AduHid.dll','OpenAduDeviceBySerialNumber',PN,N );

Going by the examples in the docs, the 'PN' and 'N' should be quoted - not barewords as you have done.
Maybe you should also turn on warnings ?

However, in your case, I would probably be using Inline::C or XS to access the functionality assuming you have an import lib (AduHid.lib) as well as the dll.

Untested:
---------------------------------------------
use warnings;
use strict;
use Inline C => Config =>
BUILD_NOISY => 1,
INC =>'-IC:/path/to/AduHid_header', # if relevant
LIBS => '-LC:/path/to/import_lib -lAduHid';

use Inline C => <<'EOC';
#include <AduHid.h> // if relevant
int wrap_OpenAduDeviceBySerialNumber(char * str, unsigned long num) {
return OpenAduDeviceBySerialNumber(str, num);
}

EOC

my $ret = wrap_OpenAduDeviceBySerialNumber("A03744",0);
print $ret, "\n";
---------------------------------------------

Cheers,
Rob

.