본문 바로가기
삽질/Delphi

[Delphi] 작업표시줄 시계부분 위치찾기

by 푸딩s 2013. 7. 30.


작업표시줄 위치에 상관없이

시계부분에 팝업을 띄우기 위해서 


var

  h: HWND;

  WorkRect: TRect;

  BarData: TAppBarData;


begin


  h := FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'TrayNotifyWnd', nil);

  GetWindowRect(h, &WorkRect);


  BarData.HWND := 0;

  BarData.cbSize := sizeof(BarData);

  SHAppBarMessage(ABM_GETTASKBARPOS, BarData);


  case BarData.uEdge of

    0: // ABE_LEFT

      begin

        self.Left := WorkRect.Right;

        self.Top := WorkRect.Bottom - self.Height;

      end;

    1: // ABE_TOP

      begin

        self.Left := WorkRect.Right - self.Width;

        self.Top := WorkRect.Bottom;

      end;

    2: // ABE_RIGHT

      begin

        self.Left := WorkRect.Left - self.Width;

        self.Top := WorkRect.Bottom - self.Height;

      end;

    3: // ABE_BOTTOM

      begin

        self.Left := WorkRect.Right - self.Width;

        self.Top := WorkRect.Top - self.Height;

      end;

  end;


end;





댓글