----- Original Message ----- 
From: "Veli-Pekka Tätilä" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, August 17, 2005 3:41 PM
Subject: Getting the Mouse Pointer Location Regardless of Active Window


> Hi,
> A simple question with a complex answer, I guess. that is I'd like to be
> 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.

>From the Win32::API documentation (beware of line wraps):

 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";

__END__

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to