PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
How do I... Disable Control Alt Delete?-VBForums
Page 1 of 2 12 LastLast
Results 1 to 40 of 77

Thread: How do I... Disable Control Alt Delete?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    27

    Angry 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.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,683

    Re: How do I... Disable Control Alt Delete?

    You can't.
    I don't live here any more.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    27

    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!!

  4. #4
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,683

    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.

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,730

    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

  6. #6
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461

    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)

  7. #7
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,683

    Re: How do I... Disable Control Alt Delete?

    Ctrl Shift Esc just brings up the task manager.
    I don't live here any more.

  8. #8
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461

    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)

  9. #9
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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

  10. #10
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    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
    Godwin

    Help someone else with what someone helped you!

  11. #11
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  12. #12
    Addicted Member Luke K's Avatar
    Join Date
    Jun 2004
    Location
    Perth, Australia
    Posts
    183

    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:
    1. 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

  13. #13
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,817

    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
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  14. #14
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    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...

  15. #15
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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:
    1. 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.

  16. #16
    Junior Member
    Join Date
    Jan 2006
    Posts
    31

    Re: How do I... Disable Control Alt Delete?

    Why do you want to disaply their keyboard, mouse and Ctrl, Alt Del ?

  17. #17
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  18. #18
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    Re: How do I... Disable Control Alt Delete?

    Quote 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...

  19. #19
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  20. #20
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,695

    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.
    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

  21. #21
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    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.
    If my post has been helpful, please rate it!

  22. #22
    Hyperactive Member Coool's Avatar
    Join Date
    Feb 2006
    Location
    System.Coool
    Posts
    333

    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

  23. #23
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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:
    1. If CBool(GetAsyncKeyState(VK_LWIN) And &H8000) And (Hookstruct.vkCode = VK_E) Then  
    2.             Return True 'This blocks the combo   '''''''''''''''''''''''''''''''''''''''''''''
    3.         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

  24. #24
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Re: How do I... Disable Control Alt Delete?

    so could u post the full code for disabling one specific keyboard key?
    If my post has been helpful, please rate it!

  25. #25
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  26. #26
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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

  27. #27
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    Re: How do I... Disable Control Alt Delete?

    the code is so long... is all that needed for just one key?
    If my post has been helpful, please rate it!

  28. #28
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  29. #29
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    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.
    If my post has been helpful, please rate it!

  30. #30
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.".

  31. #31
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    Re: How do I... Disable Control Alt Delete?

    Kthxbye for today

  32. #32
    Hyperactive Member Coool's Avatar
    Join Date
    Feb 2006
    Location
    System.Coool
    Posts
    333

    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

  33. #33
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    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?
    If my post has been helpful, please rate it!

  34. #34
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  35. #35
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    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
    If my post has been helpful, please rate it!

  36. #36
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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!

  37. #37
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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.

  38. #38
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    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...
    If my post has been helpful, please rate it!

  39. #39
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    536

    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

  40. #40
    Hyperactive Member JXDOS's Avatar
    Join Date
    Aug 2006
    Location
    Mars...
    Posts
    423

    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...
    If my post has been helpful, please rate it!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width