Sisyphus wrote:
From: "Veli-Pekka Tätilä" <[EMAIL PROTECTED]> <snip>
able to get the mouse pointer location in Perl regardless of whether
mouse events are going  to muy application window or to some other
thread or process in stead.
use Win32::API;
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";

Hi,
Thanks for a quick reply. I should have known there's a Win32 function to do this. My first attempt was to look up Win32 functions by category and as there seemed to be nothing appropriate under Mouse Input and no other category starting with mouse, I thought hooks are the only way to go.

On an OT:ish side note under which category is this GetCursorPos function in the Win32 API and is it a new addition? I've got Visual Studio 6 and the 99 MSDN so it might not be entirely up to date any more.

With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED])
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to