daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest May 19th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  AppController.m
  3. //  GlobalEvents
  4. //
  5. //  Created by John Carlyle on 4/14/10.
  6. //  Copyright 2010 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import "AppController.h"
  10. #import <Carbon/Carbon.h>
  11.  
  12. OSStatus myHotKeyHandler(EventHandlerCallRef nextHandler, EventRef anEvent, void *userData);
  13.  
  14. @implementation AppController
  15.  
  16. - (void)awakeFromNib
  17. {
  18.     EventHotKeyRef myHotKeyRef;
  19.     EventHotKeyID myHotKeyID;
  20.     EventTypeSpec eventType;
  21.    
  22.     eventType.eventClass=kEventClassKeyboard;
  23.     eventType.eventKind=kEventHotKeyPressed;
  24.    
  25.     InstallApplicationEventHandler(&myHotKeyHandler,1,&eventType,NULL,NULL);
  26.    
  27.     myHotKeyID.signature='mhk1';
  28.     myHotKeyID.id=1;
  29.    
  30.     RegisterEventHotKey(0x1a, cmdKey+optionKey+shiftKey+controlKey, myHotKeyID, GetApplicationEventTarget(), 0, &myHotKeyRef);    
  31. }
  32.  
  33.  
  34. OSStatus myHotKeyHandler(EventHandlerCallRef nextHandler, EventRef anEvent, void *userData)
  35. {
  36.     NSLog(@"GLOBAL HOTKEY PRESSERATED");
  37.    
  38.     return noErr;
  39. }
  40.  
  41. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top