Click to See Complete Forum and Search --> : Trapping CTRL-ALT-DEL


TheCPUWizard
June 13th, 2002, 12:45 PM
OK guys, I'll admit I'm being brain-dead today. I need to prectent an application from being interrupted or switched away from.

Specifically I need to trap CTRL+ALT+DEL, ALT-TAB, CTRL-ESC. I've added keyobard hooks to my app, but the keys still function (ie. I still get the windows security popup on a CTRL-ALT-DEL).

If anyone has a working sample, or even just some hints, they can have my first born son (he's 23, married 2-kids, but a real hard worker!).

Thanks in Advance


Did you ever get SO confused, you thought you knew what you were doing????

Ungi
June 14th, 2002, 12:48 AM
The Topic is "HOWTO: Block CTRL+ALT+DEL and ALT+TAB in Windows 95 or Windows 98".

I hope you're using one of this system. (Actually I don't hope it for you!!)


Private Const SPI_SCREENSAVERRUNNING = 97&
Private Declare Function SystemParametersInfo Lib "User32" _
Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
lpvParam As Any, _
ByVal fuWinIni As Long) As Long

Private Sub Form_Load()
Command1.Caption = "Disabled"
Command2.Caption = "Enabled"
End Sub

Private Sub Form_Unload(Cancel As Integer)
'Re-enable CTRL+ALT+DEL and ALT+TAB before the program terminates.
Command2_Click
End Sub

Private Sub Command1_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, _
blnOld, _
0&)
End Sub

Private Sub Command2_Click()
Dim lngRet As Long
Dim blnOld As Boolean
lngRet = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, _
blnOld, _
0&)
End Sub

TheCPUWizard
June 14th, 2002, 06:56 AM
That was a method that worked way back then. Does NOT work for 2000, XP, or ME!!!!

Please give me some credit for having researched MSDN. I pay enough for the substrciption:D

Ungi
June 14th, 2002, 07:06 AM
works for winME!!

have all a nice weekend!

Ungi

jparsons
June 14th, 2002, 02:35 PM
Originally posted by TheCPUWizard
That was a method that worked way back then. Does NOT work for 2000, XP, or ME!!!!

Please give me some credit for having researched MSDN. I pay enough for the substrciption:D

From what I understand, Ctrl-Alt-Del is intercepted by the operating system so that you can't create a trojan login very easily. Then again last nights celebration may still be affecting me.

TheCPUWizard
June 14th, 2002, 04:24 PM
JParsons <- You are 100% correct that is the intent.

On the other hand there are time when you want to make sure that your program is not interrupted. In this case it is a very real-time industrial program that can not tolerate any external loads on the processor.

Before anyone comments... Lets not get into the discussion of using windows for this type of application, or the benifits of embedded versions of windows. I am stuck with the environment I have (at least for a while) inducing corporate change at this level is not an overnight thing. The sam applices for converting this to a service. Thanks!

JMS
June 17th, 2002, 02:00 PM
Linux has a reboot command which allows one to turn on and off the three fingered solute.


Let's see... the ctrl-tab and ctrl-esc sequences could be handled in any of the windows platforms if your project was a "system modal" application.

Ctrl-alt-del can not be disabled or enabled from a normal program. This is a security feature of 2000 believe it or not. On could right a service but you've said that is not an option for your problem. This leaves you with the configuration modification to the user account running your app if and only if you have admin priveledges to that box...

To Enable or Disable the CTRL+ALT+DELETE Sequence
Click Start , click Control Panel , and then click User Accounts .

Click the Advanced tab.

In the Secure logon section, select or clear the Require users to press Ctrl+Alt+Delete check box.


hope this helps.. How old are your kids kids? and are they part of the deal?

littlemutex
June 19th, 2002, 12:22 AM
U can't trap CTRL+ALT+DEL in win2k and winnt using keyboard hooks. This fact is very well documented in MSDN. IF ur very desperate to trap the CTRL+ALT+DEL then u can try writing ur own keyboard driver...:( ...beleive me the only other solution is knowing someone in the MS Win2k development team.

JMS
June 20th, 2002, 02:46 PM
enabling or disabling the three fingered solute is a parameter of the user account running the application in question. If one wants to disable the cntrl-alt-del key sequence one can just edit the login privledges of the account as I detailed above.

Bob Davis
June 21st, 2002, 08:22 AM
I'm pretty sure you're mistaken, JMS. The option you're specifying in the User Accounts section controls whether or not the user must press CTRL+ALT+DEL at logon time, not at any time. If it is selected, then at the login screen, they must press C+A+D before they can login. It does not allow or prevent them from using the keyboard combination once they are in Windows.