'控制桌面图标和状态条的可见性
Public Const SW_HIDE = 0 ' Hide Window
Public Const SW_SHOW = 5 ' Show Window
Public Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public 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
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Function Fun_DisplayTaskBar(ByVal bShow As Boolean) As Integer '显示/隐藏 状态栏
Dim lTaskBarHWND As Long
Dim lRet As Long
Dim lFlags As Long
On Error GoTo vbErrorHandler
lFlags = IIf(bShow, SW_SHOW, SW_HIDE)
lTaskBarHWND = FindWindow("Shell_TrayWnd", "")
lRet = ShowWindow(lTaskBarHWND, lFlags)
If lRet < 0 Then
Exit Function
End If
vbErrorHandler:
End Function
Function Fun_DisplayDeskTopIcons(ByVal bShow As Boolean) As Integer '显示/隐藏 桌面图标
Dim lDesktopHwnd As Long
Dim lFlags As Long
On Error Resume Next
lDesktopHwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
If lDesktopHwnd = 0 Then
Exit Function
End If
lFlags = IIf(bShow, SW_SHOW, SW_HIDE)
ShowWindow lDesktopHwnd, lFlags
End Function
定义
Const ABM_GETTASKBARPOS = &H5
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type APPBARDATA
cbSize As Long
hWnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long
End Type
使用
Dim data As APPBARDATA
data.cbSize = Len(data)
Call 使用(ABM_GETTASKBARPOS, data)
' data.rc.Left 等於工作列的左边界
' data.rc.Top 等於工作列的上边界
' data.rc.Right 等於工作列的右边界
' data.rc.Bottom 等於工作列的下边界
Returns a message-dependent value. For more information, see the Microsoft Platform SDK documentation for the appbar message sent.
dwMessage
Appbar message value to send. This parameter can be one of the following values: ABM_ACTIVATE Notifies the system that an appbar has been activated.
ABM_GETAUTOHIDEBAR Retrieves the handle to the autohide appbar associated with a particular edge of the screen.
ABM_GETSTATE Retrieves the autohide and always-on-top states of the Windows taskbar.
ABM_GETTASKBARPOS Retrieves the bounding rectangle of the Windows taskbar.
ABM_NEW Registers a new appbar and specifies the message identifier that the system should use to send notification messages to the appbar.
ABM_QUERYPOS Requests a size and screen position for an appbar.
ABM_REMOVE Unregisters an appbar, removing the bar from the system's internal list.
ABM_SETAUTOHIDEBAR Registers or unregisters an autohide appbar for an edge of the screen.
ABM_SETPOS Sets the size and screen position of an appbar.
ABM_WINDOWPOSCHANGED Notifies the system when an appbar's position has changed.
pData
Address of an APPBARDATA structure. The content of the structure depends on the value set in the dwMessage parameter.