[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

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 ?
0
dipix
Asked:
dipix
1 Solution
 
RuchiCommented:
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

0
 
RuchiCommented:
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

0
 
RuchiCommented:
Oops!
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
SpriCommented:
To disable C-A-D entirely add this to your code where appropriate:
(top of mod or frm)
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

X = SystemParametersInfo(97, BOOLEAN, lpvparam, 0)

where BOOLEAN can be true or false


0
 
headerCommented:
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.
0
 
caraf_gCommented:
Got a suspicion that this will not work in Windows NT
0
 
ChaseZeroCommented:
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
0
 
caraf_gCommented:
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.
0
 
dipixAuthor Commented:
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
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now