Link to home
Start Free TrialLog in
Avatar of dipix
dipix

asked on

CTRL ALT DEL

I have an VB6 application running that I do not want the user to be able to shut down or kill the OS using the CTL-ALT-DEL key sequence.  I have tried looking at Windows 95 API calls and returning false to any calling routines to no avail.  Can I intercept this sequence from getting to the OS ? If so, how ?
Avatar of Ruchi
Ruchi

to disable the Ctrl-Alt-Del, put in this code:

Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long

Private Sub Form_Unload(Cancel As Integer)
Call RegisterServiceProcess(0&, 0&)
End Sub

Private Sub Form_Load()
Call RegisterServiceProcess(0&, 1)
End Sub

to disable the Ctrl-Alt-Del, put in this code:

Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long

Private Sub Form_Unload(Cancel As Integer)
Call RegisterServiceProcess(0&, 0&)
End Sub

Private Sub Form_Load()
Call RegisterServiceProcess(0&, 1)
End Sub

Oops!
ASKER CERTIFIED SOLUTION
Avatar of Spri
Spri

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note:

Spri's answer will turn off Ctrl+Alt+Del AND Alt+Tab until you call the SystemParametersInfo again or the system is rebooted.

The basic idea behind Spri's answer is it fakes the computer into thinking that a screen saver is running.  When a screen saver is running, Windows does not allow Ctrl+Alt+Del or Alt+Tab.

Ruchi's answer simply hides your application from the task list.  So the user can still press Ctrl+Alt+Del, they just can't shut down your application.
Got a suspicion that this will not work in Windows NT
Yup these will not work with NT, or Windows2000 as they were disabled (the APIs anyway)

Cos i think ppl at Microsoft got fedup of programmers doing this
Nothing to do with Micro$oft getting fed up.

Windows is (supposed to be) a multi-tasking operating system. What dipix is trying to do is similar to a single workstation taking over the whole mainframe. It is simply not on.
Avatar of dipix

ASKER

Thank you all for your input.  I was able to implement the code and it seems to be working well.  To bad about the limitations on the newer OSs.  The idea for us is to not allow disgruntled employes to purposly shut down our sytem at the application level. This would ideed cause havoc at the various plants where our sytems have been implemented.

Cheers all and cudos to Spri !!

Ron