I just downloaded the DLL from here and the following code works for me now.
I noticed there are 32 and 64-Bit versions of the DLL. Make sure you are using the one that matches your Perl (64 bit most likely, find out by perl -v).
use strict;
use warnings;
use Win32::API;
my $FCWInitObject = Win32::API->Import(
'D:\ENV\USBaccess.dll', 'int FCWInitObject()',
);
die "Error: ".( Win32::FormatMessage( Win32::GetLastError() ) ) if !$F
+CWInitObject;
my $FCWOpenCleware = Win32::API->Import(
'D:\ENV\USBaccess.dll', 'int FCWOpenCleware(int a)',
);
die "Error: ".( Win32::FormatMessage( Win32::GetLastError() ) ) if !$F
+CWOpenCleware;
my $pointer = $FCWInitObject->Call();
print "Pointer $pointer\n";
my $success = $FCWOpenCleware->Call( $pointer );
print "Success $success\n";
Works in the sense that it outputs the following and does not throw an error:
Pointer 8350080
Success 0
That makes kinda sense since I don't have a device connected that could be "opened" but why does it then return a pointer in the first place?
holli
You can lead your users to water, but alas, you cannot drown them.
|