1
我想用下面的代碼來禁用系統的鍵盤快捷鍵:不能禁用系統的鍵盤快捷鍵
#import "AppDelegate.h"
#import "Carbon/Carbon.h"
@implementation AppDelegate
void *oldHotKeyMode;
@synthesize window = _window;
-(void)dealloc
{
[super dealloc];
}
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
oldHotKeyMode = PushSymbolicHotKeyMode(kHIHotKeyModeAllDisabled);
}
-(void)applicationWillTerminate:(NSNotification *)notification
{
PopSymbolicHotKeyMode(oldHotKeyMode);
}
@end
但它不工作。我究竟做錯了什麼?