Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to Disable the system keys from your application Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
27-Dec-02
Category
Internet / Web
Language
Delphi 5.x
Views
155
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Lou Adler 

When my application is running, I'd like to prevent users from using Ctrl-Alt-Del 
and Alt- Tab. What's the best way to do this?

Answer:

This is pretty quick one... The best way I've seen yet is to trick Windows into 
thinking that a screen saver is running. When Windows thinks a screensaver is 
active, Ctrl-Alt-Del and Alt-Tab (Win95 only for this) are disabled. You can 
perform this trickery by calling a WinAPI function, SystemParametersInfo. For a 
more in-depth discussion about what this function does, I encourage you to refer to 
the online help.

In any case, SystemParametersInfo takes four parameters. Here's its C declaration 
from the Windows help file:

1   BOOL SystemParametersInfo(
2     UINT uiAction, // system parameter to query or set
3     UINT uiParam, // depends on action to be taken
4     PVOID pvParam, // depends on action to be taken
5     UINT fWinIni // user profile update flag
6     );


For our purposes we'll set uiAction to SPI_SCREENSAVERRUNNING, uiParam to 1 or 0 (1 
to disable the keys, 0 to re-enable them), pvParam to a "dummy" pointer address, 
then fWinIni to 0. Pretty straight-forward. Here's what you do:
7   
8   //To disable the keystrokes, write this:
9   
10  SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, @ptr, 0);
11  
12  //To enable the keystrokes, write this:
13  
14  SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @ptr, 0);

Not much to it, is there? Thanks to the folks on the Borland Forums for providing this information!

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC