• 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
Re: Now CGEventCreateKeyboardEvent just doesn't work...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Now CGEventCreateKeyboardEvent just doesn't work...


  • Subject: Re: Now CGEventCreateKeyboardEvent just doesn't work...
  • From: Gregory Cooksey <email@hidden>
  • Date: Fri, 6 Oct 2006 10:19:51 -0500

On Oct 4, 2006, at 11:27 AM, Ondra Cada wrote:

On 4.10.2006, at 16:37, Eric Schlegel wrote:

The recommended workaround is to call CFRelease(CGEventCreate (NULL)) before calling the other APIs

thanks a lot.

Well... now it does not crash, but it does not seem to do anything else, either. May I please ask for a bit more advice what am I overlooking? I would think the following code should hide iTunes; it does not though -- regardless the value of wait I try:

I think that I was unable to get events created with the default source to work, but had success when I created and used a private source:


/* psn holds target's PSN, code is keycode to send, state is up/down */
CGEventSourceRef source = CGEventSourceCreate (kCGEventSourceStatePrivate);
CGEventRef ev = CGEventCreateKeyboardEvent(source, code, state);
CGEventPostToPSN(&psn, ev);


-Greg

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >CGEventCreateKeyboardEvent just crashes?!? (From: Ondra Cada <email@hidden>)
 >Re: CGEventCreateKeyboardEvent just crashes?!? (From: Eric Schlegel <email@hidden>)
 >Now CGEventCreateKeyboardEvent just doesn't work... (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Icons in column-headers
  • Next by Date: Re: NSStatusItem's Image transparency
  • Previous by thread: Re: Now CGEventCreateKeyboardEvent just doesn't work...
  • Next by thread: MEETING: Chicago - CocoaHeads / CAWUG October 10th
  • Index(es):
    • Date
    • Thread