Disable Windows Shortcuts

Chris11

Active member
Joined
Jul 12, 2009
Messages
29
Programming Experience
1-3
Is it possible to disable windows shortcuts in vb.net, if so how?

I need to be able to disable: start key, ctrl-alt-del, ctrl-shift-esc.

I have created a lock screen program simliar to the defult windows one. The only problem is that you can use ctrl-alt-del to get to the "account menu" thing. (No idea what it is called) From there you can shutdown the computer.

If anyone knows if you can do this then please give me a shout...
 
hi
its easy to disable taskmgr
first you gotta know how to work w Windows registry ,
go to this path :
Hive: HKEY_CURRENT_USER
Key: Software\Microsoft\Windows\CurrentVersion\Policies\System
then make a value in the right panel with this name
Name: DisableTaskMgr
then :
Value: 1=Enable this key TaskManager
Value: 0=Disable this key TaskManager
you can easily change this value by your code , when the user press on any key that intended to open taskmgr , will confront with error ...
for using registry commands you need to use " Imports Microsoft.Win32 "
namespace
cheer
 
Riiiight ok..... How do I do that in code? Because I have no idea??

And I also think that disabling task manager won't completly solve this, I need to disable this window
images


As you maybe able to see there is a shutdown button there. I think it would be best if I disabled task manager and this whole window.
 
Last edited:
hi
VB.NET:
   Dim regKey As RegistryKey
        Dim ver As Decimal
        regKey = Registry.LocalMachine.OpenSubKey("Software\MyApp", True)
        regKey.SetValue("AppName", "MyRegApp")
        ver = regKey.GetValue("Version", 0.0)
        If ver < 1.1 Then
            regKey.SetValue("Version", 1.1)
        End If
        regKey.Close()
 
Ok...

I have no idea what that lot means, you may have to break it down for me....

And is it possible to disable that window I was on about?

I also found this vista : disable ctrl + alt + del

I talks about filtering out the ctrl alt del keys?


By the way I won't be able to reply for 7 days....
 
Last edited:
i gave u an example of using registry functions & how to set or read value from registry.
beside all of these stuffs , i think that disabling ctrl + alt + del in windows vista must be different from windows xp ..
btw u have 2 option , to disable Task Manager From registry ( as i gave u an example of source code )
the second option is , you can use of Windows hooking APIs , you can find out What kind of keys are pressing at the same time .
i hope i gave u an appropriate solution
 
By using the Windows hooking APIs would I be able to stop the the function being called from the user pressing the key's? Remember the point of this to stop all action on the ctrl + alt + del key's.
 
yeah even you can hook the active window on your desktop, then kill the process so easily ! so the user wont be able to use that window with that title
 
its a part of my Keylogger source , you can see the APIs that i used in ,
its too easy to figure out what to do, you can google the rest of it
VB.NET:
Imports System
Imports System.IO
Imports System.Windows.Forms
Imports System.Text
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Class Form1

    Private strLetter As String = ""

    Private ret As Integer

    Private counter As Integer = 0
    Dim mm As Boolean
    Private m_LastHwnd As Integer
    Public Const VK_TAB = &H9
    Public Const VK_CONTROL = &H11
    Public Const VK_ESCAPE = &H1B
    Public Const VK_DELETE = &H2E
    Const VK_SHIFT As Integer = &H10
    Const VK_ALT As Integer = &H12

    Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Integer

    Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer

    Declare Function GetWindowText Lib "user32" 
Alias "GetWindowTextA" (ByVal hwnd As Integer,
 ByVal lpString As String, ByVal cch As Integer) As Integer

    Private Declare Function GetAsyncKeyState 
Lib "user32" Alias "GetAsyncKeyState" 
(ByVal vkey As Integer) As Integer
    Private Function GetWindowTitle(ByVal window_hwnd As Integer) 
As String
 
if you are new to this topic , go & find some key loggers or spy ware tools , then you can feel what do they do ! they are not your active form in Operation system , but they can find out What window is active right now , where is ur mouse position , what keys are you typing ? & so on
for reaching these facilities , you need to know what is Hooking Topic , you in the Google & search for Windows Hooking DLL - windows Hooking source code & something like that
its not a method just for windows , it can be done on Linux or other Operation System like FREEBSD ...
i have done it in other OSs
 
OK, i've found this if it helps

VB.NET:
Private Sub Form_Unload(ByVal Cancel As Integer)
        hook.StopHook(WH_KEYBOARD_LL)
        hook = Nothing
        apiLink = Nothing
    End Sub
    Private Sub hook_KeyDown(ByVal VKey As Long, ByVal scanCode _
    As Long, ByVal ExtendedKey As Boolean, ByVal AltDown As _
    Boolean, ByVal Injected As Boolean, ByVal Cancel As Boolean)
        'Alt Tab
        If AltDown And VKey = vbKeyTab Then
            Cancel = True
            'Alt Esc
        ElseIf AltDown And VKey = vbKeyEscape Then
            Cancel = True
            'Ctrl Esc   
        ElseIf VKey = vbKeyEscape Then
            'Check if a ctrl key down
            If GetKeyState(vbKeyLCtrl) And &HF0000000 Or _
            GetKeyState(vbKeyRCtrl) And &HF0000000 Then
                Cancel = True
            End If
            'Windows key (L/R). Used to "disable" the start menu.
            'Stops single keydown of a windows key
        ElseIf VKey = vbKeyLWin Or VKey = vbKeyRWin Then
            Cancel = True
            'Windows + Any
            'If there is a hotkey combination being pressed,
            'the Windows key will not be stored in VKey,
            'So I check the state of the windows keys.
            'If they are down, cancel keys
        Else
            If GetKeyState(vbKeyLWin) And &HF0000000 Or _
            GetKeyState(vbKeyRWin) And &HF0000000 Then
                Cancel = True
            End If
        End If
        'This is totally optional of course
        If Cancel = True Then
            'We have stopped some keystrokes. Beep
            MessageBeep(0)
        End If

    End Sub

This bit goes in the form load

VB.NET:
apiLink = New EventVB.APIFunctions
        hook = apiLink.System.Hooks
        hook.StartHook(WH_KEYBOARD_LL, HOOK_GLOBAL)

There are some errors, that I don't know how to fix.

I found the script at: [ame=http://www.vbforums.com/showthread.php?t=267226]VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys - VBForums[/ame]

And you have to do something with this file: http://www.vbforums.com/attachment.php?attachmentid=33688&d=1106907920

Add it to the references somehow?
 
Last edited:
Back
Top