When you run that file as 'perl mymod.pm' you get output like the following (depending upon just where the cursor is located):package mymod; use warnings; use Win32::API; #### define the structure Win32::API::Struct->typedef( POINT => qw{ LONG x; LONG y; }); #### import an API that uses this structure Win32::API->Import('user32', 'BOOL GetCursorPos(LPPOINT lpPoint)'); #### create a 'POINT' object my $pt = Win32::API::Struct->new('POINT'); #### call the function passing our structure object GetCursorPos($pt); #### and now, access its members print "The cursor is at: $pt->{x}, $pt->{y}\n"; 1;
Next, try running the following script (named 'test.pl'):D:\pscrpt>perl mymod.pm The cursor is at: 584, 1017 D:\pscrpt>perl mymod.pm The cursor is at: 213, 542
That consistently produces the following output for me (with an accompanying segfault):use warnings; use mymod;
I can't offer a useful explanation of this ... but I guess it has something to do with the quirky way that Win32::API::Struct goes about doing whatever it is that Win32::API::Struct does.D:\pscrpt>perl test.pl Win32::API::parse_prototype: WARNING unknown output parameter type 'BO +OL' at D:/ perl58_M/site/5.8.8/lib/Win32/API.pm line 273. Use of uninitialized value in concatenation (.) or string at mymod.pm +line 21. Use of uninitialized value in concatenation (.) or string at mymod.pm +line 21. The cursor is at: ,
In reply to Re: Win32::API missing types
by syphilis
in thread Win32::API missing types
by Nemurenai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |