473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
2 2541
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dariusz Tomoń | last post by:
Hello Quick question: how can I execute Windows command (like deleting liles from server) via ASP? best regards D.T.
0
by: Damon | last post by:
Hi, I need to query each column's constraint and name of a table in postgreSQL v7.3.4 with a single SQL query but don't know how. Would appreciate any pointers! Thank you. Regards, Damon
1
by: Rick | last post by:
I created a simple Windows app in VS.NET on Windows XP I copied the "AppName.EXE" and the "AppName.Exe.Config" to a folder on a "WINDOWS 2003 Server" The application opens fine over the browser...
3
by: Robb Gilmore | last post by:
Hi, I need to write a C#.NET PC application that can talk to a non-windows device using a USB-IrDA adapter. I have been searching for information about how to do this, and the bext info I have...
0
by: jpegny | last post by:
Hello all, I'm in the middle of setting up a windows 2003 server for asp.net (with vb.net 2003) remote development/deployment. The problem is that as soon as I install service pack 1 on...
6
by: nsjmetzger | last post by:
I have a script that runs fine in Windows 2003 (32-bit). It basically calls the Windows defrag command. When I try the exact same code on Windows 2003 (64-bit) I get the following message: ...
0
by: Chris | last post by:
Hi I need to develop a training application. I would like to use the functionality of windows messenger and "embed" it in a branded web page in the same way you can take Windows Media Player and...
4
by: shaileshkumar | last post by:
hi, my name is shailesh,recently i was asked to find the database details(version,name etc) via a java program. please help me shailesh
0
by: philaphan80 | last post by:
I'm hoping someone can offer some guidance regarding a concept I have. I'm trying to perform the following within Windows Explorer: 1. Add an entry to the context menu which should be executed...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.