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
'定义窗口以及子窗口的类名
Private Const sTrayWindow = "Shell_TrayWnd"
Private Const sDesktopIcon = "ShellDll_DefView"
Private Const sProgman = "Progman"
Private Const SW_SHOW = 5
Private Const SW_HIDE = 0
Dim wnd As Long, wnd1 As Long
Dim lbHide As Boolean
Private Sub Command1_Click()
Dim i As Integer
wnd1 = FindWindow(sTrayWindow, vbNullString)
wnd = FindWindow(sProgman, vbNullString)
wnd = FindWindowEx(wnd, 0, sDesktopIcon, vbNullString)
If lbHide = False Then
ShowWindow wnd, SW_HIDE
ShowWindow wnd1, SW_HIDE
lbHide = True
Else
ShowWindow wnd, SW_SHOW
ShowWindow wnd1, SW_SHOW
lbHide = False
End If
End Sub
'是不是要这样的效果啊!