Solved

Disable Ctrl+Alt+Delete and Alt+F4

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now