Solved

Disable Ctrl+Alt+Delete and Alt+F4

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 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…
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…

749 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