它實際上被稱爲較低的任務欄。
hTBWnd = FindWindow函數(_T( 「HHTaskBar」),NULL)
這可以讓你的句柄到任務欄。然後,您可以使用GetWindowRect來獲取任務欄的四個角,並通過從底部減去頂部來計算高度。如果沒有找到HHTaskBar,托盤可能會工作。
HWND hTBWnd;
RECT windowRect;
hTBWnd = FindWindow(_T("HHTaskBar"), NULL);
if (hTBWnd != NULL)
{
GetWindowRect(hwnd, &windowRect);
CString csLongAsString;
csLongAsString.Format(_T("Height: %ld"), windowRect.bottom - windowRect.top);
MessageBox(NULL, csLongAsString, _T("HHTaskBar"), MB_OK);
return(0);
} else
{
hTBWnd = FindWindow(_T("Tray"), NULL);
if (hTBWnd != NULL)
{
GetWindowRect(hwnd, &windowRect);
CString csLongAsString;
csLongAsString.Format(_T("Height: %ld %ld"), windowRect.bottom, windowRect.top);
MessageBox(NULL, csLongAsString, _T("Tray"), MB_OK);
} else
{
MessageBox(NULL, _T("Window get failed"), _T("FAILED TO FIND WINDOW"), MB_OK);
return(0);
}
}
其實我想HHTaskBar並沒有工作,但我會努力托盤,看看它是否正常工作的問題,謝謝:) – Ayman 2010-10-27 14:27:08