Equivalent Carbon 32-bit call for using in 64-bit application - GetApplicationEventTarget().
Posted
by Dheeraj
on Stack Overflow
See other posts from Stack Overflow
or by Dheeraj
Published on 2010-05-28T13:24:12Z
Indexed on
2010/05/28
14:12 UTC
Read the original article
Hit count: 323
Hi All,
I'm writing a 64-bit Cocoa application. I need to register for global key events. So I wrote this piece of code :
- (void)awakeFromNib
{
EventHotKeyRef gMyHotKeyRef;
EventHotKeyID gMyHotKeyID;
EventTypeSpec eventType;
eventType.eventClass=kEventClassKeyboard;
eventType.eventKind=kEventHotKeyPressed;
eventType.eventClass=kEventClassKeyboard;
eventType.eventKind=kEventHotKeyPressed;
InstallApplicationEventHandler(&MyHotKeyHandler,1,&eventType,NULL,NULL);
gMyHotKeyID.signature='htk1';
gMyHotKeyID.id=1;
RegisterEventHotKey(49, cmdKey+optionKey, gMyHotKeyID,
**GetApplicationEventTarget**(), 0, &gMyHotKeyRef);
}
But since GetApplicationEventTarget()
is not supported for 64-bit applications I'm getting errors. If I declare it, then I don't get any errors but the application crashes.
Is there any equivalent method for GetApplicationEventTarget()
(defined in Carbon framework) to use in 64-bit applications.
Or is there any way to get the global key events using cocoa calls?
Any help is appreciated.
Thanks, Dheeraj.
© Stack Overflow or respective owner