home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Ctrl Esc Blocker"
- ClientHeight = 2325
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 4440
- Height = 2730
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 2325
- ScaleWidth = 4440
- Top = 1140
- Width = 4560
- Begin CheckBox Check1
- Caption = "Block Ctrl-Esc only when this App is active"
- Height = 285
- Left = 120
- TabIndex = 3
- Top = 1260
- Width = 3975
- End
- Begin ccWinHook WinHook1
- Left = 120
- Messages = CTRL_ESC.FRX:0000
- Monitor = 6 'Systemwide
- Top = 1680
- End
- Begin CommandButton Exit
- Caption = "Exit"
- Height = 555
- Left = 3000
- TabIndex = 0
- Top = 1680
- Width = 1305
- End
- Begin Label Label2
- Caption = "This allows you to bring up the system Task List only from the System-Switch To menu command."
- Height = 405
- Left = 90
- TabIndex = 2
- Top = 690
- Width = 4245
- End
- Begin Label Label1
- Caption = "This sample program prevents the Ctl+Esc key from bringing up the system TaskList."
- Height = 465
- Left = 360
- TabIndex = 1
- Top = 90
- Width = 3675
- End
- Option Explicit
- Const BLOCK_THISTASKACTIVE = 4
- Const BLOCK_ALWAYS = 6
- Const WM_SYSCOMMAND = &H112
- Const SC_TASKLIST = &HF130
- Sub Check1_Click ()
- If Check1.Value Then
- ' block the Ctl+Esc key from bringing up the task list only
- ' if this is the active application
- WinHook1.Monitor = BLOCK_THISTASKACTIVE
- Else
- ' always block the Ctl+Esc key from bringing up the task list
- WinHook1.Monitor = BLOCK_ALWAYS
- End If
- End Sub
- Sub Exit_Click ()
- Unload Me
- End Sub
- Sub Form_Load ()
- If Check1.Value Then
- ' block the Ctl+Esc key from bringing up the task list only
- ' if this is the active application
- WinHook1.Monitor = BLOCK_THISTASKACTIVE
- Else
- ' always block the Ctl+Esc key from bringing up the task list
- WinHook1.Monitor = BLOCK_ALWAYS
- End If
- End Sub
- Sub WinHook1_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, nodef As Integer)
- ' When the user hits the Ctrl+Esc key, Windows sends a WM_SYSCOMMAND message to the active
- ' application. The information in the message tells the active application to bring up
- ' the Task List. You cannot use tbe Keyboard Hook to throw the Ctrl-Esc key message away
- ' because the WM_SYSCOMMAND message is sent before the Key message.
- If msg = WM_SYSCOMMAND Then
- If wp = SC_TASKLIST Then
- ' When the user selects the "Switch To..." command from the System menu, lp
- ' contains the cursor coordinates. When the user hits the Ctrl+Esc key, lp
- ' is not used, and is set to 0. By blocking the WM_SYSCOMMAND message only
- ' when lp = 0, we allow the user to bring up the Task List via the System menu.
- If lp = 0 Then
- ' Set nodef to True to prevent other windows hooks from processing the message
- ' and set msg to 0 (Windows will ignore the message if it is 0). Refer to the
- ' SpyWorks-VB manual's section on the nodef parameter in SBCHOOK.VBX on why
- ' we cannot just set nodef = True.
- nodef = True
- msg = 0
- End If
- End If
- End If
- End Sub
-