Re: Detect the login window is being displayed
Re: Detect the login window is being displayed
- Subject: Re: Detect the login window is being displayed
- From: "Maggie Zhang" <email@hidden>
- Date: Thu, 13 Nov 2008 16:36:37 -0800
We have login agent and daemon components which do the work regarding user
logout. I am trying the SystemConfiguration which we were using a bit in the
daemon component.
Do you mean I just need to get a callback when somebody logs out?
In order to make SCDynamicStoreCopyConsoleUser work, do I need to find the
current user info and give the uid and gid of the current user? Or
SCDynamicStoreCopyConsoleUser(NULL,
NULL, NULL) will do the work? I tried NULL for uid and gid but I got uid =
56 and gid = 0, which definitely wasn't the right user information I
expected to see.
Will the callback be sent as well when the machine shuts down or restarts? I
only want to get it when user logs out otherwise I won't be able to
distinguish logout from shutdown or restart.
Thanks for your help!
On Wed, Nov 12, 2008 at 8:48 PM, Ryan McGann <email@hidden> wrote:
> Originally, I need to distinguish logging out from shutting down or
>> restarting. Since there isn't an easy way to do that, I am thinking to
>> find
>> a way to tell only when the user is logging out and let the machine do
>> whatever it wants when shutting down or restarting.Do you have a better
>> idea
>> how to do it?
>>
> This is going to be hard to distinguish depending on what you mean by
> "daemon". If you are a true daemon (that runs outside the login context),
> then you can use SystemConfiguration. You will get a callback when somebody
> logs in and logs out.
>
> However if you are a Cocoa application (which I assume you are since you
> posted to cocoa-dev) then this will be difficult to determine. Your
> application will be quit by loginwindow regardless of whether the user is
> restarting or logging out, because either way all Cocoa/Carbon applications
> will be quit. The login/logout notifications will only be posted after your
> application has already quit.
>
> Please describe what you mean by "daemon" and how your application is being
> launched.
>
> Ryan
> email@hidden
>
_______________________________________________
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