Einzelnen Beitrag anzeigen

GroZ

Registriert seit: 6. Jul 2015
Ort: Harz
167 Beiträge
 
Delphi 7 Personal
 
#1

Appbar überdeckt StandartTaskleiste

  Alt 10. Aug 2015, 10:20
Delphi-Version: 7
Hey habe jetzt eine Appbar erstellt geht auch an die Rechte seite aber überdeckt die Normale Windowsleiste. Was halt nicht sein soll.
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalc,
  Buttons, Menus, dxTaskbarProgress, StdCtrls, cxButtons, cxCalendar, ShellApi;

type
  TForm1 = class(TForm)
    Uhr: TcxClock;
    MailBtn: TcxButton;
    Googlesuche: TEdit;
    WordBtn: TcxButton;
    CalcBtn: TcxButton;
    FaceBtn: TcxButton;
    AmazonBtn: TcxButton;
    procedure GooglesucheKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private-Deklarationen }
    fAppBarData: _AppBarData;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.GooglesucheKeyDown(Sender: TObject;
var Key: Word;
    Shift: TShiftState);
var X : string;
begin
  X := GoogleSuche.Text;
  if key = VK_Return then
  begin
  ShellExecute(handle, nil, Pchar('https://www.' + X + '.de'), nil, nil, SW_SHOW)
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
const WM_APPBARMSG = WM_USER + 1;
var iResult: integer;
begin
  fAppBarData.cbSize := SizeOf(TAppBarData);
  fAppBarData.hWnd := Self.Handle;
  fAppBarData.uCallbackMessage := WM_APPBARMSG;
  fAppBarData.uEdge := ABE_RIGHT;
  fAppBarData.rc.Left := Screen.Width - Self.Width;
  fAppBarData.rc.Right := Screen.Width;
  fAppBarData.rc.Top := 0;
  fAppBarData.rc.Bottom := Screen.Height; //Denke das es hier dran liegt jedoch welchen wert muss ich eingeben?

  iResult := SHAppBarMessage(ABM_NEW, fAppBarData);
  if iResult = 0 then
  begin
    ShowMessage('Die TaskBar konnte nicht erstellt werden. Möglicherweise existiert bereits eine TaskBar an dieser Position');
    Exit;
  end;
  self.Width := screen.Width;
  SHAppBarMessage(ABM_QUERYPOS, fAppBarData);
  SHAppBarMessage(ABM_SETPOS, fAppBarData);
  Application.ProcessMessages;
  MoveWindow(fAppBarData.hWnd, fAppBarData.rc.left, fAppBarData.rc.top,
  GetSystemMetrics(SM_CXSCREEN), fAppBarData.rc.Bottom, true);

  end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  SHAppBarMessage(ABM_REMOVE, fAppBarData);
end;

end.
Julian
  Mit Zitat antworten Zitat