Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: WinAPI и системное программирование > Узнать, с какой стороны таскбар


Автор: BaD_SeCt0R 30.9.2007, 16:37
Код

type
  TSides = (sdLeft, sdRight, sdTop, sdBottom);
//...
function GetTaskBarSide:TSides;
var
  TrayRect: TRect;
begin
  if GetWindowRect(FindWindow('Shell_TrayWnd',''),TrayRect) then
   begin
    if (TrayRect.Left=0) and (TrayRect.Top=0) and (TrayRect.Bottom=Screen.Height) then
      Result:= sdLeft;
    if (TrayRect.Left>0) and (TrayRect.Top=0) then
      Result:= sdRight;
    if (TrayRect.Left=0) and (TrayRect.Top=0) and (TrayRect.Right=Screen.Width) then
      Result:= sdTop;
    if (TrayRect.Left=0) and (TrayRect.Top>0) then
      Result:= sdBottom;
   end;
end;
//...
procedure TForm1.Button1Click(Sender: TObject);
begin
  case GetTaskBarSide of
    sdLeft: Caption:='Слева!';
    sdRight: Caption:='Справа!';
    sdTop: Caption:='Сверху!';
    sdBottom: Caption:='Снизу!';
  end;
end;

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)