Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
- Subject: Re: Trapping user shutdown/logout/restart in Cocoa/Foundation tool
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 4 Jan 2008 16:06:35 +0100
Le 4 janv. 08 à 15:38, parag vibhute a écrit :
Hi guys,
I want to trap user user shutdown/logout/restart. For that I am using
-(void)workspaceWillPowerOff:(NSNotification *)aNotification. But
for this,
it is necessary to have dock icon of an application. I searched the
google &
came to know that it is required to have dock icon to trap
shutdown/restart/shutdown. My code is c++ code, but for trapping
shudown/restart/logout only, I am wrapping that C++ code in cocoa. I
have
two questions:
1. Is there any other way to trap shutdown/restart/logout without
requiring
to have type of project as Cocoa (i.e. either through Foundation
tool or
like that).
2. Is there any way to trap shutdown/restart/logout in cocoa
application
without requiring to have dock icon of an application?
Please reply.
Thanks,
Palav
1. Look like you want to use IORegisterForSystemPower();
This is plain C so it works in command line tools and in Cocoa
Application.
There is also a Q&A that explains how to use it http://developer.apple.com/qa/qa2004/qa1340.html
2. it probably works if you create a standard Cocoa Application and
add the LSUIElement in the Info.plist.
See http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html
for details about this key.
Regards
Jean-Daniel_______________________________________________
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