VB中如何禁用开始菜单的快捷键啊
发布网友
发布时间:2024-08-20 09:49
我来回答
共1个回答
热心网友
时间:2024-08-30 17:57
这个程序能够完全禁止开始菜单,而且能够恢复开始菜单,ctrl+esc和win键都不管用,但是在xp,2k下还是能够通过taskmgr.exe(任务管理器)运行新的程序,所以还要禁止ctrl+alt+del。
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Dim task As Long
Dim win As Long
Dim bswap As Boolean
Private Sub Command1_Click()
If Not bswap Then
SetParent win, Me.hwnd
ShowWindow win, 0
Else
SetParent win, task
ShowWindow win, 1
End If
bswap = Not bswap
End Sub
Private Sub Form_Load()
task = FindWindow("Shell_TrayWnd", vbNullString)
If task Then
win = FindWindowEx(task, 0, "Button", vbNullString)
If win Then
Else
MsgBox "没有找到开始按钮"
Unload Me
End If
Else
MsgBox "没有找到任务栏"
Unload Me
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If bswap Then
SetParent win, task
ShowWindow win, 1
End If
End Sub