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).