Re: Alternative startup for application
Re: Alternative startup for application
- Subject: Re: Alternative startup for application
- From: Ashley Clark <email@hidden>
- Date: Fri, 2 Apr 2010 11:33:04 -0500
On Apr 2, 2010, at 10:30 AM, Jens Alfke wrote:
> On Apr 2, 2010, at 1:45 AM, Gideon King wrote:
>
>> 1. I'm not sure what keyboard or mouse options could be used for this, since all the character keys change the selection in Finder, and all the normal modifier keys are used for special functions. So first question is how I can differentiate this special mode open from a normal open?
>
> The Option key is the usual thing. iTunes and iPhoto recognize it at startup, for example.
>
>> 2. If the application is started up in this special way, how would I be able to detect it, seeing as there is no current event to query?
>
> I would have said GetKeys(), but it seems to have been deprecated and removed in the eyeblink [read: decade] since I last used Carbon. There must be some modern equivalent for reading the current state of the keyboard?
This works in Snow Leopard and Leopard (I believe).
- (void)applicationDidFinishLaunching:(NSNotification *)notif {
CGEventRef event = CGEventCreate(NULL);
CGEventFlags modifiers = CGEventGetFlags(event);
CFRelease(event);
CGEventFlags flags = (kCGEventFlagMaskAlternate | kCGEventFlagMaskControl);
if ((modifiers & flags) == flags)
[self doSomethingSpecial];
}
Ashley
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden