此一問題需呼叫 SHAppBarMessage API 函數,細節如下:
1. API 的宣告:
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
注:如果以上的宣告放在「一般模組」底下, 應在 Const 之前加上 Public 保留字,
並且將Private 保留字去掉。
2. 程式范例:
Dim data As APPBARDATA
data.cbSize = Len(data)
Call SHAppBarMessage(ABM_GETTASKBARPOS, data)
' data.rc.Left 等於工作列的左邊界
' data.rc.Top 等於工作列的上邊界
' data.rc.Right 等於工作列的右邊界
' data.rc.Bottom 等於工作列的下邊界
請注意以上求出之工作列位置及大小是以 pixel(像素) 為單位。