Solved

Disable Ctrl-Alt-Del from a form

Posted on 2002-06-28
10
599 Views
Last Modified: 2012-06-27
I have one form in my app that I want to completely lock the end-user from exiting except by one command button.  I have disabled other controls and set the ControlBox property of the form to False.  I have set the BorderStyle to Fixed Single.  At this point, the only way they can exit the form is through Ctrl-Alt-Del.  I tried to cancel the Keycode value in the KeyDown event of the form when Shift = 6 (Ctrl+ALT) but I still brought up TaskManager when I hit the Del key.  I'm hesitant to modify Registry settings because if the computer goes down then an NT/2000 machine might never allow a log-on (requires Ctrl-Alt-Del).  If anybody has an idea I'd be greatly appreciative!  Thanks for your thoughts!
0
Comment
Question by:jmerritt
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7116733
i think that in queryunload event of form you could use:
if unloadmode = 2 or unloadmode=3 then
cancel=true
end if
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 7116765
It isn't going to work on NT or any NT based O/S such as 2000 and XP. To trap the Ctrl+Alt+Delete key combination is impossible because it is handled by the GINA.DLL before it is actually processed by the keyboard buffer. This means that to do anything with this combination requires a complete rewrite of the underlying security of the operationg system GINA is responsible for authentication. It is possible to do as some companies such as Novell have done in association with Microsoft though I have never found anyone else willing to attempt this task.

It is possible in 9x and ME by use of the ScreenSaverIsRunning flag.

Option Explicit

Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long

Private Const SPI_SETSCREENSAVERRUNNING = 97

Public Sub DisableCAD(Disabled As Boolean)

'SET DISABLED TO TRUE TO DISABLE CTRL-ALT-DELETE
'SET DISABLED TO FALSE TO RE-ENABLE

    Dim lRet As Long
    lRet = SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, _
      Disabled, 0&, 0&)
End Sub  

Code from http://www.freevbcode.com
0
 
LVL 4

Expert Comment

by:frankd
ID: 7116969
Tim is right, I have seen products advertised that do this with NT but I have no experience with them.  

I use a package called Wonderware (Operator Interface Software for Machine controls) and they have a dll called keytrap.dll that does it even on NT,  the downside is that you have to have Wonderware running for it to work.  I do use it with NT. Then, within Wonderware I check who is logged on and if they have the proper security I enable the Ctrl-Alt-Del key combination.

Good luck.

Frank
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7117076
i was with Tim in first place, so i posted a different way.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7121233
Which version of wonderware do you use Frank, I am familiar with InTouch/InTrack 7.0 but had never come across the keytrap.dll
0
 
LVL 4

Expert Comment

by:frankd
ID: 7121580
Tim,

I've used the keytrap dll in WW version 5.6 right up to the present version 7.11.  If you have the Knowledge base CD the complete description is listed.

Frank
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7121589
Thanks Frank I may well look into that, though I try to avoid Wonderware as much as possible. I even wrapped all the InTrack functionality into a VB dll so that I could use it natively in VB with the ability to return some stuff as ADO recordsets rather than the garbled stuff that you sometimes get from it.

I must say that I think I now hate wonderware with a passion, especially when you compare it with VB, it may have improved in the last version or two but I doubt it somehow.
0
 
LVL 1

Author Comment

by:jmerritt
ID: 7121599
Thanks anyway.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7121632
I had a quick look Frank, and without installing WW on this machine I think it would actually be possible to get it to work, the dll is only there to respond to events raised by the keyboard driver (this is a replacement for the standard driver, which is why I guess you can do this). It would be possible to determine what the API calls for the dll would be and utilize these in VB proper. One day perhaps I will investigate this however it would be no good for jmerrit as it would be almost impossible to distribute and would also probably incur WW licensing problems as well.
0
 
LVL 4

Expert Comment

by:frankd
ID: 7122350
Tim,

I agree with everything you said.  Right now I'm using VB to get data from InSql (Wonderware's wrapper) and it's a nightmare.

If it was my choice I'd stay away from WW as well, but my company is sold on it (about 50 licenses).

Frank
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question