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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.