-
May 23rd, 2005, 08:42 AM
#1
Thread Starter
Junior Member
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.
-
May 23rd, 2005, 08:44 AM
#2
Re: How do I... Disable Control Alt Delete?
I don't live here any more.
-
May 23rd, 2005, 09:45 AM
#3
Thread Starter
Junior Member
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!!
-
May 23rd, 2005, 09:51 AM
#4
Re: How do I... Disable Control Alt Delete?
Well, I'm still new to this programming thing. You're probably right.
I don't live here any more.
-
May 23rd, 2005, 03:43 PM
#5
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.
My usual boring signature: Nothing
-
May 24th, 2005, 02:51 AM
#6
Hyperactive Member
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!
Live long and prosper (Mr. Spock)
-
May 24th, 2005, 03:13 AM
#7
Re: How do I... Disable Control Alt Delete?
Ctrl Shift Esc just brings up the task manager.
I don't live here any more.
-
May 24th, 2005, 06:00 AM
#8
Hyperactive Member
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 !
Live long and prosper (Mr. Spock)
-
Sep 2nd, 2005, 07:45 AM
#9
Re: How do I... Disable Control Alt Delete?
[QUOTE]Here is a slightly modified version of Paul Kimmel's article for keyboard hooking.
CtrlAltDelete
Last edited by TTn; Jan 20th, 2008 at 01:49 PM.
Reason: runs smoother
-
Sep 2nd, 2005, 09:13 AM
#10
Fanatic Member
-
Sep 3rd, 2005, 07:28 AM
#11
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.
I updated the code so that it does not freeze, and is very clean. (no flashing)
I pre-initialized the process at form load.
Last edited by TTn; Sep 10th, 2005 at 10:38 AM.
-
Feb 10th, 2006, 03:56 AM
#12
Addicted Member
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.
Artificial Intelligence At War! - The best game of its genre
Program your own robot and watch it fight in 3d!
Droidarena 3
If I have been useful, please Rate My Post
Support FireFox -
Microsoft Visual Studio .NET Professional 2003
Microsoft Visual Studio 6, Enterprise Edition
Microsoft Windows XP Professional, Service Pack 2
-
Feb 10th, 2006, 04:19 AM
#13
Re: How do I... Disable Control Alt Delete?
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
-
Feb 10th, 2006, 04:31 AM
#14
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.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 12th, 2006, 11:29 PM
#15
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.
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.
Last edited by TTn; Feb 13th, 2006 at 12:08 AM.
-
Feb 13th, 2006, 12:34 AM
#16
Junior Member
Re: How do I... Disable Control Alt Delete?
Why do you want to disaply their keyboard, mouse and Ctrl, Alt Del ?
-
Feb 13th, 2006, 01:24 AM
#17
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.
-
Feb 13th, 2006, 02:06 AM
#18
Re: How do I... Disable Control Alt Delete?
Originally Posted by TTn
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
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 13th, 2006, 02:18 AM
#19
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.
-
Feb 24th, 2006, 03:57 PM
#20
Re: How do I... Disable Control Alt Delete?
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Dec 15th, 2006, 10:53 PM
#21
-
Dec 15th, 2006, 11:19 PM
#22
Hyperactive Member
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 ?
I am using .NET 2010 with Windows 7
-
Dec 16th, 2006, 03:35 PM
#23
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
-
Dec 17th, 2006, 12:20 AM
#24
-
Dec 17th, 2006, 07:16 AM
#25
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.
-
Dec 17th, 2006, 07:49 AM
#26
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
Last edited by TTn; Jan 19th, 2008 at 03:12 AM.
-
Dec 17th, 2006, 07:51 AM
#27
-
Dec 17th, 2006, 08:03 AM
#28
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.
-
Dec 17th, 2006, 08:23 AM
#29
-
Dec 17th, 2006, 08:35 AM
#30
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.".
-
Dec 17th, 2006, 09:11 AM
#31
Re: How do I... Disable Control Alt Delete?
Kthxbye for today
-
Dec 17th, 2006, 09:47 AM
#32
Hyperactive Member
Re: How do I... Disable Control Alt Delete?
Thanks TTn I am going to rate this post.
I am using .NET 2010 with Windows 7
-
Dec 18th, 2006, 01:40 AM
#33
-
Dec 18th, 2006, 06:57 AM
#34
Re: How do I... Disable Control Alt Delete?
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.
-
Dec 20th, 2006, 08:30 AM
#35
-
Dec 20th, 2006, 06:32 PM
#36
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!
-
Dec 20th, 2006, 06:54 PM
#37
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.
-
Dec 21st, 2006, 08:40 AM
#38
-
Dec 21st, 2006, 05:51 PM
#39
Re: How do I... Disable Control Alt Delete?
Okay you need to stop saying it doesn't work. Right now.
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
-
Dec 30th, 2006, 12:26 AM
#40
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
|