By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,016 Members | 2,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,016 IT Pros & Developers. It's quick & easy.

How know windows locked (via ctrl-alt-del)?

P: n/a
How do i know if windows has been locked (via ctrl-alt-del)?

I need to know because I'm running my app as a service and I want to
suppress sounds when the desktop's locked (it currently plays them).
Oct 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"John Smith" <as****@asdasd.comwrote in message
news:OK****************@TK2MSFTNGP03.phx.gbl...
How do i know if windows has been locked (via ctrl-alt-del)?

I need to know because I'm running my app as a service and I want to
suppress sounds when the desktop's locked (it currently plays them).
You can register a handler for the SessionLock event.

That said, I'm not convinced that it makes sense to implement as a service
something that is tied to a specific user.
Oct 26 '06 #2

P: n/a
Make sure you don't cut the sound for every session when one session
locks... If you're working with WinXP, no problem because I think you can't
have 2 simultaneous sessions alive. But if you are working with a server
version of windows (win2k (adv)server or win2k3) you could have problems
with the remote desktop applications (Terminal Service, etc.)

Anyway, here's how you can detect session lock/unlock... this way is
extremely precise and does not require a lot of CPU usage (almost none)...
;)

in your load method (or anywhere you want)
SystemEvents.SessionSwitch += new
SessionSwitchEventHandler(SystemEvents_SessionSwit ch);

Here's an example of the Event Handler
void SystemEvents_SessionSwitch(object sender,
SessionSwitchEventArgs e)
{
if (e.Reason == SessionSwitchReason.SessionLock)
Fire_OnSessionLock();
else if (e.Reason == SessionSwitchReason.SessionUnlock)
Fire_OnSessionUnlock();
}

I hope it helps...

ThunderMusic

"John Smith" <as****@asdasd.comwrote in message
news:OK****************@TK2MSFTNGP03.phx.gbl...
How do i know if windows has been locked (via ctrl-alt-del)?

I need to know because I'm running my app as a service and I want to
suppress sounds when the desktop's locked (it currently plays them).


Oct 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.