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 ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Dim task As Long Dim win As Long Dim bswap As BooleanPrivate Sub Command1_Click() If Not bswap Then ShowWindow win, 0 Else ShowWindow win, 1 End If bswap = Not bswap End SubPrivate 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 SubPrivate Sub Form_Unload(Cancel As Integer) If bswap Then ShowWindow win, 1 End If End Sub
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 ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Dim task As Long
Dim win As Long
Dim bswap As BooleanPrivate Sub Command1_Click()
If Not bswap Then
ShowWindow win, 0
Else
ShowWindow win, 1
End If
bswap = Not bswap
End SubPrivate 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 SubPrivate Sub Form_Unload(Cancel As Integer)
If bswap Then
ShowWindow win, 1
End If
End Sub