• 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: CGEventCreateKeyboardEvent just crashes?!?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGEventCreateKeyboardEvent just crashes?!?


  • Subject: Re: CGEventCreateKeyboardEvent just crashes?!?
  • From: Philip Dow <email@hidden>
  • Date: Wed, 4 Oct 2006 14:17:31 +0200

Hi Ondra,

I ran into this problem a while ago and never could figure out what was wrong. If you don't need the CGEventRef back, trying using CGPostKeyboardEvent() instead. It looks like this:

CGPostKeyboardEvent((CGCharCode)0, (CGKeyCode)56, true);

-Phil

On Oct 4, 2006, at 1:56 PM, Ondra Cada wrote:

Hi all,

anybody can use CGEventCreateKeyboardEvent?

I create the simplest project possible. Call the function exactly the way it's documented. And always got a nice small SIGBUS...

Here's my source:

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, Apple World! What's there with them blasted events?!?");
CGEventRef er=CGEventCreateKeyboardEvent (NULL, (CGKeyCode)56, true); // directly from docs
NSLog(@"actually, got event ref at %x. Bye.",er);
[pool release];
return 0;
}


Here's the project (I've tried plain C one, too): http://www.ocs.cz/ apps/CGEventCrash.zip

Will be very grateful for any advice what I do wrong...
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


_______________________________________________ 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


_______________________________________________ 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>)

  • Prev by Date: CGEventCreateKeyboardEvent just crashes?!?
  • Next by Date: MEETING: Chicago - CocoaHeads / CAWUG October 10th
  • Previous by thread: CGEventCreateKeyboardEvent just crashes?!?
  • Next by thread: Re: CGEventCreateKeyboardEvent just crashes?!?
  • Index(es):
    • Date
    • Thread