-
June 10th, 2008, 08:49 AM
#1
disable windows, ctrl, alt, del key
This semester I have task to build an internet kiosk software. But, I face difficulty to start it. I don't know how to disable and enable windows key, ctrl+alt+del key, and the alt+tab key.
Is there anyone know how to do that??? I'm using vb.net 2008.
I'll very appreciate for your help. Thanks
-
June 10th, 2008, 09:13 AM
#2
Re: disable windows, ctrl, alt, del key
write your own msgina.dll to process the low level interrupt emitted by those keys
Or just rip the Alt key off the keyboard. It's a lot easier
-
June 10th, 2008, 10:09 AM
#3
Re: disable windows, ctrl, alt, del key
My solution:
Depending on what control it is, say a RichTextBox, you can handle the KeyDown/Up/Press events.
Code:
Private Sub rtb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles rtb.KeyDown
If e.KeyCode = Keys.Enter Then 'blocks the enter key
e.Handled = True
EndIf
End Sub
-
June 10th, 2008, 03:19 PM
#4
Re: disable windows, ctrl, alt, del key
Alt - Ctrl - Del, is a system event and cannot be locked, however the rest can and have been done, search the forum and you will find answers..
Gremmy..
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
June 10th, 2008, 10:45 PM
#5
Re: disable windows, ctrl, alt, del key
I have just done a kioskprogram that works on Windows XP.
To disable buttons you only add a Scancode map to the registry.
See http://www.microsoft.com/whdc/archive/w2kscan-map.mspx.
That will not block ctrl-alt-del, even if you disable those buttons.
The ctrl-alt-del event is handled in msgina.dll. A lot of other things are also hanled in that dll. To disable CTRL-ALT-DEL on WinXP you need to write your own gina.dll. The idea is to pass everything through to msgina.dll except for when CTRL-ALT-DEL is handled.
You can download a ginastub from Microsoft in a Platform SDK. There is an example but it's not complete.
You could have my code, if I only knew where to send it.
-
June 11th, 2008, 01:19 AM
#6
Re: disable windows, ctrl, alt, del key
What I did once was to create a keyboard hook, like :
Code:
'system hook libraries
Imports System.Runtime.InteropServices 'MarshalAs, Marshal
Imports System.Reflection 'assembly
'''''''''''''''''''''''''''''''
Public Class frmJolt
Inherits System.Windows.Forms.Form
''''''''''''''''''''''''''''''''''''''''''''''''''''
'disable alt+tab and ctrl+esc and alt esc system keys
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Integer) As Integer
Public Declare Function SetWindowsHookEx Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook As Integer, _
ByVal lpfn As KeyboardHookDelegate, ByVal hmod As Integer, _
ByVal dwThreadId As Integer) As Integer
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Integer) As Integer
Private Declare Function CallNextHookEx Lib "user32" _
(ByVal hHook As Integer, _
ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByVal lParam As KBDLLHOOKSTRUCT) As Integer
Public Structure KBDLLHOOKSTRUCT
Public vkCode As Integer
Public scanCode As Integer
Public flags As Integer
Public time As Integer
Public dwExtraInfo As Integer
End Structure
' Low-Level Keyboard Constants
Private Const HC_ACTION As Integer = 0
Private Const LLKHF_EXTENDED As Integer = &H1
Private Const LLKHF_INJECTED As Integer = &H10
Private Const LLKHF_ALTDOWN As Integer = &H20
Private Const LLKHF_UP As Integer = &H80
' Virtual Keys
Public Const VK_TAB = &H9
Public Const VK_CONTROL = &H11
Public Const VK_ESCAPE = &H1B
Public Const VK_DELETE = &H2E
Public Const VK_MENU = &H12
Private Const WH_KEYBOARD_LL As Integer = 13&
Public KeyboardHandle As Integer
' Implement this function to block as many
' key combinations as you'd like
Public Function IsHooked( _
ByRef Hookstruct As KBDLLHOOKSTRUCT) As Boolean
If (Hookstruct.vkCode = VK_ESCAPE) And _
CBool(GetAsyncKeyState(VK_CONTROL) _
And &H8000) Then
Call HookedState("Ctrl + Esc blocked")
Return True
End If
If (Hookstruct.vkCode = VK_TAB) And _
CBool(Hookstruct.flags And _
LLKHF_ALTDOWN) Then
Call HookedState("Alt + Tab blockd")
Return True
End If
If (Hookstruct.vkCode = VK_ESCAPE) And _
CBool(Hookstruct.flags And _
LLKHF_ALTDOWN) Then
Call HookedState("Alt + Escape blocked")
Return True
End If
Return False
End Function
Private Sub HookedState(ByVal Text As String)
Debug.WriteLine(Text)
End Sub
Public Function KeyboardCallback(ByVal Code As Integer, _
ByVal wParam As Integer, _
ByRef lParam As KBDLLHOOKSTRUCT) As Integer
If (Code = HC_ACTION) Then
Debug.WriteLine("Calling IsHooked")
If (IsHooked(lParam)) Then
Return 1
End If
End If
Return CallNextHookEx(KeyboardHandle, _
Code, wParam, lParam)
End Function
Public Delegate Function KeyboardHookDelegate( _
ByVal Code As Integer, _
ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) _
As Integer
<MarshalAs(UnmanagedType.FunctionPtr)> _
Private callback As KeyboardHookDelegate
Public Sub HookKeyboard()
callback = New KeyboardHookDelegate(AddressOf KeyboardCallback)
KeyboardHandle = SetWindowsHookEx( _
WH_KEYBOARD_LL, callback, _
Marshal.GetHINSTANCE( _
[Assembly].GetExecutingAssembly.GetModules()(0)).ToInt32, 0)
Call CheckHooked()
End Sub
Public Sub CheckHooked()
If (Hooked()) Then
Debug.WriteLine("Keyboard hooked")
Else
Debug.WriteLine("Keyboard hook failed: " & Err.LastDllError)
End If
End Sub
Private Function Hooked()
Hooked = KeyboardHandle <> 0
End Function
Public Sub UnhookKeyboard()
If (Hooked()) Then
Call UnhookWindowsHookEx(KeyboardHandle)
End If
End Sub
Private Sub frmJolt_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
HookKeyboard() 'hook system keys
Me.TopMost = True 'always on top
End Sub
This "blocked", Alt Tab, Ctrl Esc, the Windows key, but, In Windows XP, it still allowed the task manager to po up once Ctrl Alt Del was pressed. I got around that problem by setting my Form's TopMost property to True, and in a Timer, I added :
Code:
Private Sub frmJolt_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.LostFocus
Me.Focus() ' when form object loses focus (another form, control, or program - form always has focus)
End Sub
Private Sub tJolt_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tJolt.Tick
Me.BringToFront() 'top in zorder, other apps move to the back
End Sub
What this did was when the Task Manager popped up, I immediately return focus to my application, only once the application has ended, I could see the Task Manager
The basic idea of the program was to block people from accessing my pc. i set the BorderStyle to None, and used an Easter egg ( a secret key and mouse click combination ) to show my user name and Password boxes. If the correct Username and password have been entered, the application exits, if not, it will allow three tries, whichafter the system will reboot
What I'm trying to say is that, you can hide the Task Manager this way, if you don't want to write your own gina.dll
Some virus scanners, such as AVG ( which I use ), will see your gina.dll as a huge threat and most likely remove it, keep that in mind as well.
Another "bad" option, is to disable the display of the Task Manager through the registry, but I'm not going to eloborate on that. The Task Manager is there for a reason.
-
July 3rd, 2008, 05:40 AM
#7
Re: disable windows, ctrl, alt, del key
Originally Posted by HenrikLaholm
You can download a ginastub from Microsoft in a Platform SDK. There is an example but it's not complete.
You could have my code, if I only knew where to send it .
Dear HenrikLaholm, can I have your internet kiosk code to disable ctrl-alt-del, alt-tab, alt -f4, windows key. I really need that in order to accomplish my project. The time period
given for my project is almost finish. I hope that you can send it as soon as possible. Thanks.
Btw, can I have your messenger name? so I can easily contact you later....
Last edited by d_rev; July 7th, 2008 at 06:05 AM.
-
July 4th, 2008, 07:46 AM
#8
Re: disable windows, ctrl, alt, del key
Concerning your PM
Originally Posted by d_rev
Dear HanneSThEGreaT, I've tried the code you give me. The code can run, but it only can handle The alt+tab key. And it has weakness, That is , if you run it in vista. AND when you press the alt+tab and the choosen window is show desktop, it will show the desktop. Can you help me handle this problem and how to disable ctrl-alt-del and enable it again. You can send any related codes in vb.net 2008 to my email address.
One more thing, can you help me to contact HenrikLaholm. and tell him to please send the code of his internet kiosk software to my email address
I've tried to contact him. But, he disable the PM function, so I can't contact him. The time for me to finish this software is only left one until two weeks, so please help me do it as soon as possible.
Thanks for your help....
First, I do not offer help through PMs or Emails, because it doesn't benefit the community as a whole.
Second, none of us had any idea about what Operating System you are using - with these type of issues, it is absolutely essential to know what OS you are using.
I do not have such an example for Windows Vista, but, I'd recommend you do as suggested by cjard and GremlinSA.
Thirdly, I'm not the right person to speak to about contacting HenrikLaholm.
Lastly, I edited your last post because of the email address - why ¿ Well, to put your email address in a public forum such as this one, you'll end up with endless spam until infinity
Last edited by HanneSThEGreaT; July 7th, 2008 at 06:15 AM.
-
July 7th, 2008, 06:04 AM
#9
Re: disable windows, ctrl, alt, del key
Originally Posted by HanneSThEGreaT
Concerning your PM
First, I do not offer help through PMs or Emails, because it doesn't benefit the community as a whole.
Second, none of us had any idea about what Operating System you are using - with these type of issues, it is absolutely essential to know what OS you are using.
I do not have such an example for Windows Vista, but, I'd recommend you do as suggested by cjard and GremlinSA.
Thirdly, I'm not the right person to speak to about contacting HenrikLaholm.
Lastly, I edited your last post because of the email address - why ¿ Well, to put your email address in a public forum such as this one, you'll end up with endless spam until infinity
Dear HanneSTheGreat, I admit that I'm wrong. I'm sorry for that. I hope that you can edit your post by eliminating my email address. I realize that I've done a fool things. I'll do as what you says. Thanks for guiding me.
-
July 9th, 2008, 12:19 PM
#10
Re: disable windows, ctrl, alt, del key
I have sent you (d_rev) the code by mail, by replying to your mail. I replied to a hotmail address. It could not be sent to the mail address (gmail) you wrote in the mail.
The gina will not work on Vista. In Vista they have another solution.
-
March 19th, 2009, 10:49 PM
#11
Re: disable windows, ctrl, alt, del key
HenrikLaholm,
Any chance you could shoot me your msgina.dll implementation as well? I'd really appreciate it!
Thanks,
Mike
-
March 19th, 2009, 11:08 PM
#12
Re: disable windows, ctrl, alt, del key
You can NOT block c-a-d unless you eliminate GINA.dll, and the only way to do that is to write your own, and replace it.
If someone were to do that, the last thing they'd do is post it on a forum, for the same reason that you don't want your email address posted.
Plus, it would be against the AUP, bypassing the OS.
Why would you have c-a-d on a keyboard anyways? You did say that it was a KIOSK.
Give them an on-screen keyboard, if you have to, or an up/down or joystick.
-
November 8th, 2010, 08:06 PM
#13
Re: disable windows, ctrl, alt, del key
I'm surprised nobody mentioned this but why not disable it in the registry:
http://www.windowsnetworking.com/kba...XPHomePro.html
-
November 9th, 2010, 10:04 AM
#14
Re: disable windows, ctrl, alt, del key
-
November 9th, 2010, 10:33 AM
#15
Re: disable windows, ctrl, alt, del key
Originally Posted by dglienna
Not XP anymore.
What do you mean? It doesn't work on XP anymore?
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
|