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 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
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:
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.