Pasek zadań,zmieniający rozmiar pulpitu

0

Mam pytanie , jak zrobić pasek zadań widoczny np. na górze pulpitu , tak aby ikony i okna nie pojawiały się na jego obszarze , tylko pod nim , tak jakby ograniczał on rozmiar pulpitu.

Znalazłem informacje pod adresem

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/appbars.asp?frame=true#Setting_the_Appbar_S

ale mimo prób nie udało mi się przerobić tego na delphi

Z góry dzięki !!

0

Mi się troche udało, dopracuj sobie użycie tego kodu:

var
  g_uSide : Byte;
  g_fAppRegistered : Boolean;

function TToolBarForm.RegisterToolBar(hwndAccessBar: HWND;
  fRegister: Boolean): Boolean;
var
  abd : APPBARDATA;
begin
  // Specify the structure size and handle to the appbar.
  abd.cbSize := SizeOf(APPBARDATA);
  abd.hWnd := hwndAccessBar;
  if fRegister then
  begin
    // Provide an identifier for notification messages.
    abd.uCallbackMessage := APPBAR_CALLBACK;
    // Register the appbar.
    if SHAppBarMessage(ABM_NEW, abd) = 0 then
      Result := False;
    g_uSide := ABE_TOP;       // default edge
    g_fAppRegistered := True;
    AppBarQuerySetPos(g_uSide, Form1.BoundsRect, abd);
  end
  else
  begin
    // Unregister the appbar.
    SHAppBarMessage(ABM_REMOVE, abd);
    g_fAppRegistered := False;
  end;

  Result := True;
end;

procedure TToolBarForm.AppBarQuerySetPos(uEdge : UINT; lprc: TRect; pabd: APPBARDATA );
var
    iHeight : Integer;
    iWidth : Integer;
begin
  iHeight := 0;
  iWidth := 0;

  pabd.rc := lprc;
  pabd.uEdge := uEdge;
  // Copy the screen coordinates of the appbar's bounding
  // rectangle into the APPBARDATA structure.

  if (uEdge = ABE_LEFT) or (uEdge = ABE_RIGHT) then
    begin
      iWidth := pabd.rc.right - pabd.rc.left;
      pabd.rc.top := 0;
      pabd.rc.bottom := GetSystemMetrics(SM_CYSCREEN);
    end
  else
    begin
      iHeight := pabd.rc.bottom - pabd.rc.top;
      pabd.rc.left := 0;
      pabd.rc.right := GetSystemMetrics(SM_CXSCREEN);
    end;
    // Query the system for an approved size and position.
  SHAppBarMessage(ABM_QUERYPOS, pabd);

    // Adjust the rectangle, depending on the edge to which the
    // appbar is anchored. 
  ;case uEdge of
    ABE_LEFT :
            pabd.rc.right := pabd.rc.left + iWidth;
    ABE_RIGHT:
            pabd.rc.left := pabd.rc.right - iWidth;
    ABE_TOP:
            pabd.rc.bottom := pabd.rc.top + iHeight;
    ABE_BOTTOM:
            pabd.rc.top := pabd.rc.bottom - iHeight;
  end;
    // Pass the final bounding rectangle to the system.
  SHAppBarMessage(ABM_SETPOS, pabd);

  // Move and size the appbar so that it conforms to the
  // bounding rectangle passed to the system.
  MoveWindow(pabd.hWnd,
              pabd.rc.left,
              pabd.rc.top,
              pabd.rc.right - pabd.rc.left,
              pabd.rc.bottom - pabd.rc.top,
              True);
end;

procedure TToolBarForm.AppBarCallback(hwndAccessBar : HWND; uNotifyMsg : UINT; lParam : LPARAM);
var
  abd : APPBARDATA;
  uState : UINT;
begin
  abd.cbSize := sizeof(abd);
  abd.hWnd := hwndAccessBar;
  case uNotifyMsg of
    ABN_STATECHANGE:
      begin
        // Check to see if the taskbar's always-on-top state has
        // changed and, if it has, change the appbar's state
        // accordingly.
        uState := SHAppBarMessage(ABM_GETSTATE, abd);

        SetWindowPos(hwndAccessBar,
                (ABS_ALWAYSONTOP and uState) or HWND_TOPMOST or HWND_BOTTOM,
                0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
      end;
    ABN_FULLSCREENAPP:
      begin
        // A full-screen application has started, or the last full-
        // screen application has closed. Set the appbar's
        // z-order appropriately.
        if lParam > 0 then
          SetWindowPos(hwndAccessBar,
                    (ABS_ALWAYSONTOP and uState) or HWND_TOPMOST or HWND_BOTTOM,
                    0, 0, 0, 0, 
                    SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE)
        else
        begin
          uState := SHAppBarMessage(ABM_GETSTATE, abd);
          if (uState <> 0 and ABS_ALWAYSONTOP) then
                    SetWindowPos(hwndAccessBar, HWND_TOPMOST, 
                        0, 0, 0, 0, 
                        SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
        end;
      end;
    ABN_POSCHANGED:
        AppBarPosChanged(abd); // The taskbar or another appbar has changed its
                               // size or position.
  end;
end;

procedure TToolBarForm.AppBarPosChanged(abd : APPBARDATA);
var
  rc : TRect;
  rcWindow : TRect;
  iHeight : Integer;
  iWidth : Integer;
begin
  rc.top := 0;
  rc.left := 0;
  rc.right := GetSystemMetrics(SM_CXSCREEN);
  rc.bottom := GetSystemMetrics(SM_CYSCREEN);

  GetWindowRect(abd.hWnd, rcWindow);
  iHeight := rcWindow.bottom - rcWindow.top;
  iWidth := rcWindow.right - rcWindow.left;

  case g_uSide of
    ABE_TOP:
      rc.bottom := rc.top + iHeight;
    ABE_BOTTOM:
      rc.top := rc.bottom - iHeight;
    ABE_LEFT:
      rc.right := rc.left + iWidth;
    ABE_RIGHT:
            rc.left := rc.right - iWidth;
  end;
    AppBarQuerySetPos(g_uSide, rc, abd);
end;
0

Delphi 4 Vademecum profesjonalisty tom II - tworzenie pasków aplikacji :D. W Delphi 6 VP tom II też to jest (tworzenie nawet specjalnej klasy VCL dziedziczącej z TCustomForm, ciekawy bajer :D). Polecam.

1 użytkowników online, w tym zalogowanych: 0, gości: 1