How to detect if autohidden taskbar is visible or not?

我怕爱的太早我们不能终老 提交于 2019-11-29 08:58:23
HWND hTaskbarWnd = FindWindow("Shell_TrayWnd", null);
bool isVisible = IsWindowVisible(hTaskbarWnd);

or

bool IsTaskbarWndVisible() {
HWND hTaskbarWnd = FindWindow("Shell_TrayWnd", null);
HMONITOR hMonitor = MonitorFromWindow(hTaskbarWnd , MONITOR_DEFAULTTONEAREST);
MONITORINFO info = { sizeof(MONITORINFO) };
if (GetMonitorInfo(hMonitor, &info))
{
  RECT rect;
  GetWindowRect(hTaskbarWnd , &rect);
  if ((rect.top >= info.rcMonitor.bottom - 4) ||
      (rect.right <= 2) ||
      (rect.bottom <= 4) ||
      (rect.left >= info.rcMonitor.right - 2))
  return false;

  return true;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!