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.Se ssionSwitch += new
SessionSwitchEv entHandler(Syst emEvents_Sessio nSwitch);
Here's an example of the Event Handler
void SystemEvents_Se ssionSwitch(obj ect sender,
SessionSwitchEv entArgs e)
{
if (e.Reason == SessionSwitchRe ason.SessionLoc k)
Fire_OnSessionL ock();
else if (e.Reason == SessionSwitchRe ason.SessionUnl ock)
Fire_OnSessionU nlock();
}
I hope it helps...
ThunderMusic
"John Smith" <as****@asdasd. comwrote in message
news:OK******** ********@TK2MSF TNGP03.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).