-
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
-
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
-
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
-
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..
-
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.
-
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 :D
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. :wave:
-
Re: disable windows, ctrl, alt, del key
Quote:
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....
-
Re: disable windows, ctrl, alt, del key
Concerning your PM
Quote:
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
-
Re: disable windows, ctrl, alt, del key
Quote:
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.
-
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.
-
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
-
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.
-
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
-
Re: disable windows, ctrl, alt, del key
-
Re: disable windows, ctrl, alt, del key
Quote:
Originally Posted by
dglienna
Not XP anymore.
What do you mean? It doesn't work on XP anymore?
-
Re: disable windows, ctrl, alt, del key
Anything after XP that blocks registry access.
Code:
There is a registry hack to enable or disable Windows NT TaskManager. The same registry hack applies to Windows 2000 and Windows XP.
Hive: HKEY_CURRENT_USER
Key: Software\Microsoft\Windows\CurrentVersion\Policies\System
Name: DisableTaskMgr
-
Re: disable windows, ctrl, alt, del key
I haven't tested it but this site indicates that it also works for Vista and Windows 7:
http://www.vistax64.com/tutorials/10...e-disable.html
-
Re: disable windows, ctrl, alt, del key
How about just using windows steady state, create a new user for windows and lock it up (including ctrl alt del)? It's free and too easy to use!
-
Re: disable windows, ctrl, alt, del key
The original problem was for a KIOSK. The way to eliminate the CAD keys is to eliminated the whole keyboard. Usually, a KIOSK is Browser Based, and arrow keys plus enter plus delete are all that are needed!
Now, with touch-screen available, now users can do just about anything with no keyboard
-
Re: disable windows, ctrl, alt, del key
I've managed to do that thing regarding disabling the task manager itself,
by killing the process
Code:
Public Shared Function killCmd(ByVal procName As String, Optional ByVal all As Boolean = True) As Boolean
Dim val As Boolean = False
For Each procInstance As Process In Process.GetProcesses
If procInstance.ProcessName.ToLower = procName.ToLower Then
procInstance.Kill()
val = True
If Not all Then Exit For
End If
Next
Return val
End Function
' now create a timer and put this codes
Private Sub cmd_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd.Tick
killCmd("taskmgr")
End Sub
Im just bothered that's why I register and reply to this thread.
Hope I've helped you guys in some way ^_^
TIP: Kill the main function itself.
-
Re: disable windows, ctrl, alt, del key
hi everyone, this is actually my first post in this forum.
Actually, i made an info-kiosk app a few years back and the post caught my attention to see other people's suggestions.. I've read through the post and everyone have contributed a significant amount of information. I just want to conclude and suggest a Task Manager trick.
As it is already mentioned, info kiosks use special keyboards. These keyboards have no special keys like ctrl, alt, etc. I made mine for a touch screen, thus, i used an on screen keyboard which i made.
The solution given by HanneSThEGreaT to handle (block) key combinations like Alt Tab, Ctrl Esc, the Windows keys is on the correct path. Yes, you could alter (rewrite) the gina.dll but it is time-consuming and not advisable from my point. Yes, you can disable Windows Task Manager from the registry, and the links provided address this issue.
http://www.windowsnetworking.com/kba...XPHomePro.html
http://www.vistax64.com/tutorials/10...e-disable.html
Task Manager Trick:
Ok, you cannot disable Ctrl+Alt+Del, but you can just alter its effect!
Let's give it a try with an example.
1) Locate your calc.exe (windows calculator) and taskmgr.exe (windows task manager), usually in C:\Windows\System32
2) Copy both of these files to another location, for example your desktop and:
Rename taskmgr.exe -> taskmgr_.exe
Rename calc.exe -> taskmgr.exe
Thus your calc.exe is now called taskmgr.exe
3) Drag and drop your NEW taskmgr.exe (which is actually the calculator) into the C:\Windows\System32 directory, and when it asks you to replace it say yes.
4) Actually you are done, if you hit Ctrl+Alt+Del the calculator will pop-up.
Having said all that, i will give you some food for thought.. you could write your own tiny app, a not visible form maybe, which ends instantly after loading and replace taskmgr.exe with that. The user will see that nothing actually happens when Ctrl+Alt+Del is pressed. If you want to be able to access Windows Task Manager write an app which asks for password in order to run the taskmgr.exe (and if no keys pressed for 5 seconds it ends)
-
Re: disable windows, ctrl, alt, del key
This works like a dream in Windows 7 Ultimate x64:
Code:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,00,00,1d,e0,00,00,1d,00,00,00,00,00
It disables both Ctrl buttons - restart required though...
Hope it helps - you can do the same with Alt etc...
-
Re: disable windows, ctrl, alt, del key
Hey, I don't even know if this helps or not, and I am a begginer but I had long hours of thought for a simple program I was building for the school with a mark, and I figured out that in ANY OS (at least from XP on) taskmgr.exe shows up in the Task Manager, so, you do a kind of code like this:
For Each poc As process In Processes.GetProcessByName("taskmgr")
poc.Kill()
Next
Sorry if i am not right with this but it might help
-
Re: disable windows, ctrl, alt, del key
Quote:
Originally Posted by
tute.95
Hey, I don't even know if this helps or not, and I am a begginer but I had long hours of thought for a simple program I was building for the school with a mark, and I figured out that in ANY OS (at least from XP on) taskmgr.exe shows up in the Task Manager, so, you do a kind of code like this:
For Each poc As process In Processes.GetProcessByName("taskmgr")
poc.Kill()
Next
Sorry if i am not right with this but it might help
Forgotten to add that you might put it under Mouse Move action so that it kills the process every time you may also under any action even a timer as I did...
-
Re: disable windows, ctrl, alt, del key
I'm not sure how that is supposed to address the issue at hand.
Also this is an old thread as in over 3 1/2 years old so the proposed answer would do the questioner no good even if it were the correct answer.
-
Re: disable windows, ctrl, alt, del key
Not according to the AUP.
-
Re: disable windows, ctrl, alt, del key
This thread keeps being reincarnated. I will close it now.
Any future posts must be in Reference to this thread please.