Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stoping "Ctrl-Alt-Del" 1

Status
Not open for further replies.

Berras

Programmer
Feb 24, 2002
42
GB
Is there any way to stop someone from pressing Ctrl-Alt-Del while they are running my program?
 
I don't think that you can(but I'm not 100% sure)... The cleanest way that I know of is to use the signals of c++...

example

I'm writing the code without remembering the syntax but that should give you some hints when you'll search in MSDN
-------------------------------
#include <signal.h>

void exit(){
cout << &quot;Weird exit&quot; << endl;
}

void main(){
signal(SIGTERM, exit);
signal(SIGINT, exit);
signal(..., exit);
...
//some codes
}
-------------------------------
There are diferents types of signal... the best way is to call all the them

hope that'll help you...
 
I know it's possible since I've seen programs that have done it, but I'm not exactly sure how... I would think that trapping the keystrokes might do it, but that's just a guess. You also might want to trap key sequences like alt-tab, alt-escape, alt-enter, etc. Most of those will give you access to windows, allowing exiting of the program through another means.
---------------
I also found this on a google search:
Hi !
I did it , and you can be writing lowlevel hook and installing with
SetWindowsHookEx( WH_KEYBOARD_LL) where you can prevent different
combinations
like Alt+Tab to LowLevelKeyboardProc(). Yes , Alt+Tab+Del cannot be catch
by low hook ,
but my clients ( of our system ) demand it too , so
I added the program which do HOTKEY on combination and if it's pressed
check if TaskManager in the air and
disable needed buttons in it.
Not so nice as to work with GINA , but simple and customers are happy .
---------
Here is the URL:

Hope that helps.
(Note, its extremely difficult, if not impossible to disable cntrl-alt-delete on 2k/XP systems..

MG
 
If you are using MFC, simply use the function:
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0);

It will make the computer think it is in screensaver mode and disable that key sequence. To reenable that key sequence, call the function again, but change the second parameter to 0.
 
If you are using MFC, simply use the function:
Bool old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0);

It will make the computer think it is in screensaver mode and disable that key sequence. To reenable that key sequence, call the function again, but change the second parameter to 0.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top