Solved

Disable Ctrl+Alt+Delete and Alt+F4

Posted on 1999-01-18
1
2,025 Views
Last Modified: 2008-02-26
How do you disable Ctrl+Alt+Delet and Alt+F4? I am creating a login program and want to make sure that the user is unable to close down the program without logging in. (I have already disabled the X button.)
0
Comment
Question by:Kory
1 Comment
 
LVL 3

Accepted Solution

by:
HATCHET earned 100 total points
ID: 1469280
Kory,

To disable CTRL+ALT+DEL and CTRL+ESC, use the following code :
________________________________________________________________

DECLARATION / FUNCTION (place in module):

Public 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

Public Sub DisableCtrlAltDelete(bDisabled As Boolean)
  Dim X As Long
  X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub


USE (place in your code where you want to use it):

'To disable Ctrl-Alt-Delete:
Call DisableCtrlAltDelete(True)

'To enable Ctrl-Alt-Delete:
Call DisableCtrlAltDelete(False)
________________________________________________________________

To disable ALT+F4, on the form that you think they will do an ALT+F4, put a private Boolean variable in the General/Declarations section, then test that Boolean variable in the Form_Unload event.  If your program hasn't set it to TRUE, then set "Cancel = True".  This will stop the unloading of your form/program.  If you want to close your program, set that Boolean variable to TRUE, then unload all forms, and/or use the End statement.

HATCHET
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 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