• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Posting mouse clicks with multiple displays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: How to drag file promises from IKImageBrowserView?
  • Next by Date: Re: Fun (or not) with NSArrayControllers and CoreData.
  • Previous by thread: Re: How to drag file promises from IKImageBrowserView?
  • Next by thread: Looking for a method to Lock and Unlock the computer
  • Index(es):
    • Date
    • Thread