Posting mouse clicks with multiple displays
Posting mouse clicks with multiple displays
- Subject: Posting mouse clicks with multiple displays
- From: DeNigris Sean <email@hidden>
- Date: Wed, 29 Jul 2009 18:18:05 -0400
Hi list!
I'm attempting to simulate mouse clicks (I already tried accessibility
API, but I'm clicking on a flash movie in Safari, so it's not a
standard UI element and doesn't work). I've got it working, unless I
set x to a negative number to click on my second monitor, in which
case, the mouse clicks on the left edge of my primary monitor at the
correct y.
CGPoint pt;
pt.x = x;
pt.y = y;
CGEventRef down_event = CGEventCreateMouseEvent(NULL,
kCGEventLeftMouseDown, pt, 0);
CGEventRef up_event = CGEventCreateMouseEvent(NULL,
kCGEventLeftMouseUp, pt, 0);
CGEventPost(kCGHIDEventTap, down_event);
CGEventPost(kCGHIDEventTap, up_event);
CFRelease(down_event);
CFRelease(up_event);
Thanks!
Sean DeNigris
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden