它实际上被称为下部任务栏。
hTBWnd = FindWindow(_T("HHTaskBar"), NULL)
这使您可以处理任务栏。然后您可以使用GetWindowRect 获取任务栏的四个角,并通过从底部减去顶部来计算高度。如果未找到 HHTaskBar,则 Tray 可能会起作用。
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);
}
}