主要用到 SetWindowPos
首先引入
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long,ByVal hWndInsertAfter As Long,ByVal x As Long,ByVal y As Long,ByVal cx As Long,ByVal cy As Long,ByVal wFlags As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String,ByVal lpWindowName As String) As Long Const SWP_HIDEWINDOW = &H80 '隐藏 Const SWP_SHOWWINDOW = &H40 '显示
若要隐藏任务栏
Dim wnd As Long wnd = FindWindow("form1_wnd","") Call SetWindowPos(wnd,SWP_HIDEWINDOW)
若要显示任务栏
Dim wnd As Long wnd = FindWindow("form1_wnd",SWP_SHOWWINDOW)