Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
P is for Practical
 
PerlMonks  

Re^3: Low-level version of Win32::API::Struct

by bulk88 (Deacon)
on Aug 01, 2012 at 17:32 UTC ( #984847=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Low-level version of Win32::API::Struct
in thread Low-level version of Win32::API::Struct

That is not an example from the docs.

my $getCursor = new Win32::API('user32', 'GetCursorPos','S','N');
should be
my $getCursor = new Win32::API('user32', 'GetCursorPos','P','N');
since $lpPoint is a scalar string formally. 'S'/'T' are only for ::Struct objects. The result of pack() is a scalar string. Not a blessed object. If you had a newer version of ::API, you would get a proper croak message
croak("Win32::API::Call: parameter %d must be +a%s", i+1, " Win32::API::Struct object!\n");
much better than 0.68 blindly doing ->Pack() on whatever scalar happens to fall in as argument which is what is happening in your case.


Comment on Re^3: Low-level version of Win32::API::Struct
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984847]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2013-05-23 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (473 votes), past polls