|
-
August 2nd, 2001, 05:10 PM
#1
Disabling Ctrl Alt Del keys
A nice funtion to disable all the Ctrl + Alt + Del, Ctrl + Esc keys to prevent the user from exiting the form - you can also set the form's Border Style property to 0 - None.
Here's the code.
First declare the API function.
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 'API Function to disable keys
Then the sub (Also in General Declarations)
Sub DisableCtrlAltDel(bDisabled as Boolean)
' Disables Control Alt Delete Breaking
'as well as Ctrl-Escape
Dim X as Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
'to disable CtrlAltDel do a call as such...
'Call DisableCtrlAltDel(true), '
'to re-enable use false instead of true in the call.
To call the function just do like this:
Call DisableCtrlAltDel(false) 'can use true as well
Remeber to re-enable it when the program exits!
Peace!
F. T. W.
-
September 29th, 2001, 01:46 PM
#2
Re: Disabling Ctrl Alt Del keys
WOW
That's brilliant coding.
However, it does not appear to work on Windows 2000 and I was wondering if you knew why it did not work, and how I can make it work.
Thanks
Bye
WWWhy not visit James Griffiths' web site @ www.jamesgriff.co.uk
-
September 29th, 2001, 06:27 PM
#3
Re: Disabling Ctrl Alt Del keys
I haven't tested it at all on Windows 2000. Sorry... I'll do some research, and when I find the answer I'll let you know, because now I want to know why it doesn't work on Win2000 as well.
Thanx for letting me know!
Hannes
F. T. W.
-
September 30th, 2001, 12:11 PM
#4
Re: Disabling Ctrl Alt Del keys
Somebody some time ago asked how Print Screen could be disabled. Maybe you have the solution.
-
October 1st, 2001, 02:03 AM
#5
Re: Disabling printscreen
Joust a thougt:
If you are able to intercept the printscreen keystroke, you can clear the clipboard object....
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
October 1st, 2001, 09:47 AM
#6
Re: Disabling Ctrl Alt Del keys
W2000 is based on NT platform. You cannot block alt+ctrl+delete on Windows NT. Even using a low-level keyboard hook doesn't work.
NT traps this key combination before the event handler gets it and automatically handles it. The only way
that you could do anything about it would be to write your own dll which receives this event from the
O/S however this is an extremely complex task.
Iouri Boutchkine
[email protected]
-
October 1st, 2001, 10:14 AM
#7
Re: Disabling Ctrl Alt Del keys
This works by convincing windows that a screensaver is running.
In Win9x, it is the responsibility of the screensaver to validate the password so in response to getting the "Screen Saver Active" message, windows 9x disables the CTRL+ALT+DEL hotkey combination.
Because of the enourmous potential for writing a malicious screensaver application this functionality was removed from WinNT/Win2k and it is now the responsibility of the OS to handle locking/unlocking a machine.
Note that you should use the constant value:
private Const SPI_SCREENSAVERRUNNING = 97
to make this code more readable.
For a full list of system parameter info constants, see http://www.merrioncomputing.com/Even...etersInfo.html
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|