获取任务栏状态

 APPBARDATA apd;
 apd.cbSize = sizeof(apd);
 CString str;
 SHAppBarMessage(ABM_GETTASKBARPOS , &apd);
 str.Format("left %d,top %d,width %d,height %d",apd.rc.left,apd.rc.top,apd.rc.right - apd.rc.left,apd.rc.bottom -  apd.rc.top);
 UINT state = SHAppBarMessage(ABM_GETSTATE, &apd);
 switch (state)
 {
      case ABS_AUTOHIDE + ABS_ALWAYSONTOP :
            str += "State is AutoHide and alway top";
            break;
      case ABS_AUTOHIDE :
            str += "State is AutoHide and not alway top";
            break;
      case ABS_ALWAYSONTOP :
            str += "State is alway top and not autohide";
            break;
      default :
            str += "State is not autohide and not alway top";
 }
 AfxMessageBox(str);

你可能感兴趣的:(VC)