-
How do I... Disable Control Alt Delete?
I have an app that locks the keyboard and mouse. All is good, but control alt delete stops all that. When a user does the old 3 fingered salute, it unlocks the keyboard. I wish to disable the control alt delete as I lock the keyboard and mouse.
Please help,
Dan.
PS. I lock the keyboard like this:
Declare Function BlockInput Lib "User32" (ByVal fBlockIt As Boolean) As Boolean
I set blockinput(true) to lock the thingy.
-
Re: How do I... Disable Control Alt Delete?
-
Oh yes!
You could in 98 etc and NT4 but there has to be a way to use the API and hooks or something...
If you cannot do something with .net you can usually use the API!!
-
Re: How do I... Disable Control Alt Delete?
Well, I'm still new to this programming thing. ;) You're probably right.
-
Re: How do I... Disable Control Alt Delete?
You can do this with processor hooks, but I doubt the whole concept of Managed Code would allow you to do this easily. You may have to create the function in something like unmanaged C++, then call it from .NET.
-
Re: How do I... Disable Control Alt Delete?
After seen this post, I spoke, by phone, with a friend who had to solve the problem in VB6. I asked for the solution.He said to me something about to remap (is correct in english?) keyboard acting on registry. He said this is the solution suggested by microsoft, so it's possible you can find something more specific in MSDN. Ah....don't forget Ctrl+shift+esc....it has the same effect but few people know it! :)
Hope this helps. Good job! :wave:
-
Re: How do I... Disable Control Alt Delete?
Ctrl Shift Esc just brings up the task manager.
-
Re: How do I... Disable Control Alt Delete?
Yes, you are right, they are not completely the same, but it's a very dangerous one, I think, when not controlled :) !
-
Re: How do I... Disable Control Alt Delete?
[QUOTE]Here is a slightly modified version of Paul Kimmel's article for keyboard hooking.
CtrlAltDelete
-
Re: How do I... Disable Control Alt Delete?
That code is Awesome...
Just one biggg problem with that part which closes the task manager..Its freezes my comp while closing the Task manager...They can disable the ctrl+alt+del instead :) That would be a little more neater.
Recently I got some kind of dumb virus or something through Limewire....And it would start Limewire automatically even if I close it.It was sick.It disabled the ctrl+alt+Del completely too..so,please dont make some other program like that if you're using this code :) Use it for a good cause ;)
-
Re: How do I... Disable Control Alt Delete?
Uh... Show me how you can disable them in this trap?
If return true nothing is blocked.
Detect <> Disable. :rolleyes:
I updated the code so that it does not freeze, and is very clean. (no flashing)
I pre-initialized the process at form load.
-
Re: How do I... Disable Control Alt Delete?
You dont need to use any hooks, simply use 'DisableTaskMgr' in the following registry key
VB Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\System\Policies
The value name is "DisableTaskMgr". It is a dword so set it to 1 to disable the task manager and set it back to 0 to re-enable it. Whenever someone tries to access the task manager through any method, windows will block it.
-
Re: How do I... Disable Control Alt Delete?
Quote:
Originally Posted by alextyx
Yes, you are right, they are not completely the same, but it's a very dangerous one, I think, when not controlled :) !
Hi,
I'm using Windows xp pro and when I use Ctrl -Alt - Del ore Ctrl - Shft - Esc
it gave me just the same result Windows TaskMananger.
sparrow1
-
Re: How do I... Disable Control Alt Delete?
Sparrow: That depends on the way you log in.
If you use the "classic" way of loggin in (like if you're on a domain) they will have different behaviours.
Luke: That's a neat trick, but it only apply's to ctrl+shift+esc (at least when on a domain) and it shows an annoying messagebox, so I don't think that will do if one was to create a fullscreen D3D game, for instance.
-
Re: How do I... Disable Control Alt Delete?
Quote:
You dont need to use any hooks, simply use 'DisableTaskMgr' in the following registry key
VB Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\System\Policies
The value name is "DisableTaskMgr". It is a dword so set it to 1 to disable the task manager and set it back to 0 to re-enable it. Whenever someone tries to access the task manager through any method, windows will block it.
I have tried the online example that explains exactly how to do it.
I could not get it to work after retrying many variations of the example.
Please post your code for changing this registry key.
It must be created first, since it is hidden I believe.
EDIT
I can't even get this to work manually.
Maybe this is where I am wrong.
I create a new dword value named DisableTaskMgr in the policies folder.
Set the value to 1(hexadecimal), and refresh the registry editor.
Maybe this is where I am right, since the task manager works just fine.
-
Re: How do I... Disable Control Alt Delete?
Why do you want to disaply their keyboard, mouse and Ctrl, Alt Del ?
-
Re: How do I... Disable Control Alt Delete?
This is not meant for malicious purposes.
However since it could be used for bad, it is good to know about its potential.
Usually people of authority will tell you it cant be done.
Since it can be done, counter measures can be made to fix the flaws within the system.
-
Re: How do I... Disable Control Alt Delete?
Quote:
Originally Posted by TTn
Quote:
You dont need to use any hooks, simply use 'DisableTaskMgr' in the following registry key
visual basic code:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\System\Policies
The value name is "DisableTaskMgr". It is a dword so set it to 1 to disable the task manager and set it back to 0 to re-enable it. Whenever someone tries to access the task manager through any method, windows will block it.
I have tried the online example that explains exactly how to do it.
I could not get it to work after retrying many variations of the example.
Please post your code for changing this registry key.
It must be created first, since it is hidden I believe.
EDIT
I can't even get this to work manually.
Maybe this is where I am wrong.
I create a new dword value named DisableTaskMgr in the policies folder.
Set the value to 1(hexadecimal), and refresh the registry editor.
Maybe this is where I am right, since the task manager works just fine.
There's a typo. You need to swap the "Policies" and the "System" so you'll get HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System
-
Re: How do I... Disable Control Alt Delete?
Ah that seems to work better.
Well not better than my example which is clean for a gamers experience.
Thanks, I stand partially corrected, I should of tried to switch that around first. I tried so many different things... Yikes.
-
Re: How do I... Disable Control Alt Delete?
Quote:
Originally Posted by wossname
Well, I'm still new to this programming thing. ;) You're probably right.
:lol: :lol: :lol: :lol: :lol: :lol: :lol:
-
Re: How do I... Disable Control Alt Delete?
so is it impossible to disable certain keys? i've got a similar problem with my lock program. i want to disable the key combinations of anything which involves ctrl, alt, Esc, delete Tab etc.
-
Re: How do I... Disable Control Alt Delete?
and what abt Windows key. think of Widnows + E (Windows Explorer).
Now I am also interested in this. I have even a few question regarding this.
1) Is that possible to put shortcut for any program from windows using a single key from [A-Z] and [0-9] ??
2) If so than is that possible throgh hooking to allow only [a-z] and [0-9] character of the keyboard ?
-
Re: How do I... Disable Control Alt Delete?
Yes, just add the code into the "IsHooked" function, that I've posted.
Single win keys are taken care of already. So do this:
VB Code:
If CBool(GetAsyncKeyState(VK_LWIN) And &H8000) And (Hookstruct.vkCode = VK_E) Then
Return True 'This blocks the combo '''''''''''''''''''''''''''''''''''''''''''''
End If
You'll want to start a program, when a single key is pressed, by simply catching the key, as it falls throught the function, and add a Sub.
Blocking any other key is just as easy, as the keys already blocked in the example. A-Z 0-9
-
Re: How do I... Disable Control Alt Delete?
so could u post the full code for disabling one specific keyboard key?
-
Re: How do I... Disable Control Alt Delete?
Hmmmm,
I already have above.
I told you what function to view.
Just look at the win key block, for a single key example.
Do you know how to copy and paste?
Seriously, some people dont actually know how, that's why I'm asking...
Read all the green text, that is commented out.
I dont want to have to explain it all again, since there is already a good example.
Please rate the post after it works for you.
-
How to swap keyboard keys, ie press A but send Z
'Here is an example of how to SwapKeys.
'It's somewhat like SwapMouseButtons, but only for the keyboard.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HookKeyboard()
End Sub
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
UnhookKeyboard()
End Sub
Public Function IsHooked(ByRef Hookstruct As KBDLLHOOKSTRUCT) As Boolean
On Error Resume Next
If Hookstruct.flags <> 128 Then 'Do this on key down only. the flag for key up is 0.
If Hookstruct.vkCode = Keys.A Then 'If a key is pressed
apikeybd_event(Keys.Z, 0, 0, 0) 'press any key. (z in this example)
Return True
End If
'Repeat this skeleton for any key, or combo!!!
'If Hookstruct.vkCode = Keys.A Then
' apikeybd_event(Keys.Z, 0, 0, 0)
' Return True
'End If
End If
Return False
End Function
Public Structure KBDLLHOOKSTRUCT
Public vkCode, scanCode, flags, time, dwExtraInfo As Int32
End Structure
Public Delegate Function KeyboardHookDelegate(ByVal Code As Int32, ByVal wParam As Int32, ByRef lParam As KBDLLHOOKSTRUCT) As Int32
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.FunctionPtr)> Private callback As KeyboardHookDelegate
Public KeyboardHandle As Int32
Const HC_ACTION As Int32 = 0
Const WH_KEYBOARD_LL As Int32 = 13
Const VK_CONTROL As Int32 = 17
Public Declare Function apiSetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Int32, ByVal lpfn As KeyboardHookDelegate, ByVal hmod As Int32, ByVal dwThreadId As Int32) As Int32
Public Declare Function apiCallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Int32, ByVal nCode As Int32, ByVal wParam As Int32, ByVal lParam As KBDLLHOOKSTRUCT) As Int32
Public Declare Function apiUnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Int32) As Int32
Public Declare Sub apikeybd_event Lib "user32.dll" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Int32, ByVal dwExtraInfo As Int32)
Public Sub HookKeyboard()
callback = New KeyboardHookDelegate(AddressOf KeyboardCallback)
KeyboardHandle = apiSetWindowsHookEx(WH_KEYBOARD_LL, callback, System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.[Assembly].GetExecutingAssembly.GetModules()(0)).ToInt32, 0)
End Sub
Public Sub UnhookKeyboard()
If KeyboardHandle <> 0 Then apiUnhookWindowsHookEx(KeyboardHandle)
End Sub
Public Function KeyboardCallback(ByVal Code As Int32, ByVal wParam As Int32, ByRef lParam As KBDLLHOOKSTRUCT) As Int32
If Code = HC_ACTION AndAlso IsHooked(lParam) = True Then Return 1
Return apiCallNextHookEx(KeyboardHandle, Code, wParam, lParam)
End Function
-
Re: How do I... Disable Control Alt Delete?
the code is so long... is all that needed for just one key?
-
Re: How do I... Disable Control Alt Delete?
It's none or all, when it comes to system wide hooks.
In the first blocking example I suggested, you can delete the button stuff, but place the Hookkeyboard() in the load event.
Make sure you also place the UnHookKeyboard() in the closed event of the form. Like the swap keys example I just posted.
-
Re: How do I... Disable Control Alt Delete?
ok. i don't get this. im still a noob. could you plz change the code so that on form load the keys: ctrl, alt, Esc, Del, Windows, Tab are all disabled? thx.
-
Re: How do I... Disable Control Alt Delete?
Do you promise to rate the post?
Are you sure that's all you want?
For example blocking each ctrl, alt, escape keys will not block the combo.
You'll need to list the combos too.
Give details of why, if any, ie
"So someone cant close my program.".
-
Re: How do I... Disable Control Alt Delete?
-
Re: How do I... Disable Control Alt Delete?
Thanks TTn I am going to rate this post.
-
Re: How do I... Disable Control Alt Delete?
i promise to rate this post. i don't want people to close my program or ingnore it (alt - tab). if i disable the key, doesn't it mean it can't be used? (i.e. if ctrl is blocked wouldn't the combo turn into shift-esc instead of ctrl-shift-esc?)therefore combo can't work?
-
Re: How do I... Disable Control Alt Delete?
Quote:
if i disable the key, doesn't it mean it can't be used?
Not really.
For example Ctrl Alt Delete, will work no matter what keys you block.
So my example, waits ahead of time, to kill the task manager, as soon as it detects the combo being pressed.
Try the example now, it's been simplified and updated to be closer to your needs.
-
Re: How do I... Disable Control Alt Delete?
.. apparently the code doesn't actually disable any of the combos in the code...
could you plz cheack it to make sure it does.. thx
-
Re: How do I... Disable Control Alt Delete?
Please dont say that unless your sure.
I'll check it again to make sure, but I know it works perfectly.
I'm sure your doing something wrong.
In case you were using the Swapkeys example, here is the KeyBlock example.
thx, for rating the post!
-
Re: How do I... Disable Control Alt Delete?
JXDOS,
Dont feel bad, it's a common mistake to check someone code by using the debugger.
You must of been debugging the code I gave you.
In that case it will not work due to a threading BUG in 2005.
Yes I call it a bug, because it is. This should be fixed in the service pack.
If you build the executable, and then test the executable file, it will work just fine, and block all those key combos listed within.
Glad to be of help. :)
-
Re: How do I... Disable Control Alt Delete?
well, i was using the code u posted on post no.9 ... and even when i try to open the file from the debug folder (.exe) it still doesn't block any of the listed combos... i changed the 8 'menu' into 'alt'... but even so, the windows keys are still functioning and so is the combo ctrl-esc...
-
Re: How do I... Disable Control Alt Delete?
Okay you need to stop saying it doesn't work. Right now. :D
Why would you try the debug folder? Release build!!!
When you finally get it, you'll kick yourself in the ***, for not realizing how easy it was.
When you do finally get it, ...cause I know you will...
Please delete the posts, that suggest my code doesnt' work.
People will read this thread, and assume it must not work, because you couldn't get it.
Thanks
-
Re: How do I... Disable Control Alt Delete?
... well, now it partly works. ctrl-esc and ctrl-shift-esc and windows are blocked. however, the alt-F4 , alt-tab and ctrl-alt-delete still aren't blocked. i'll try and find whats wrong...