Solved

Disable Ctrl+Alt+Delete and Alt+F4

Posted on 1999-01-18
1
2,021 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now