Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Form verschwindet nicht von Taskleiste trotz code ! (https://www.delphipraxis.net/110771-form-verschwindet-nicht-von-taskleiste-trotz-code.html)

dazar_t 24. Mär 2008 16:30


Form verschwindet nicht von Taskleiste trotz code !
 
Guten Tag..

Ich Programmiere grade ein Programm ( in Delphi 2007 ) das wärend der Laufzeit immer wieder sein Größe und seinne Sichtbarkeit ändert.

Um eine Form nun von der Taskleiste zu nehmen nehme ich gewöhnlich diesen Code :
Delphi-Quellcode:
  ShowWindow( Application.Handle, SW_HIDE );
  SetWindowLong( Application.Handle, GWL_EXSTYLE,
                 GetWindowLong(Application.Handle, GWL_EXSTYLE) or
                 WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
  ShowWindow( Application.Handle, SW_SHOW );
Doch wirkt dieser bei meinem Programm nicht mehr !

Hier mal mein QuellCode :
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled := True;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Height := Screen.Height;
Form1.Width := 215;
ShowWindow( Application.Handle, SW_HIDE );
SetWindowLong( Application.Handle, GWL_EXSTYLE,
                 GetWindowLong(Application.Handle, GWL_EXSTYLE) or
                 WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
ShowWindow( Application.Handle, SW_SHOW );
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
while Not(Form1.Width = 1) do
Form1.Width := Form1.Width - 1;
Form1.Visible := False;
Timer1.Enabled := False;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
Form1.Visible := True;
while Not(form1.Width = 215) do
Form1.Width := Form1.Width + 1;
Timer2.Enabled := False;
end;

procedure TForm1.Timer3Timer(Sender: TObject);
begin
if Mouse.CursorPos.x = Screen.Width - 1 then
Timer2.Enabled := True;
Timer4.Enabled := True;
end;

procedure TForm1.Timer4Timer(Sender: TObject);
begin
if (Form1.Width = 215) and (Mouse.CursorPos.X < Screen.Width - Form1.Width) then
Timer1.Enabled := True;
Timer4.Enabled := False;
end;

procedure TForm1.WMWindowPosChanging(var Message: TWMWINDOWPOSCHANGING);
begin
  Message.WindowPos.y := 0;
  Message.WindowPos.x := Screen.WorkAreaWidth - Width;
end;

end.

EDIT: // Habe grade mal nen TestProjeckt erstellt und gemerkt das der Code garnicht mehr wirkt das Programm bleibt immer in der Taskbar.
Als ich es aber in D7 probierte funktionierte es !??? :shock:

VnCoders 25. Mär 2008 00:20

Re: Form verschwindet nicht von Taskleiste trotz code !
 
You cannot resize the Form Width to 0 with Form's BorderStyle is bsSizable. You should change it to bsNone.

dazar_t 25. Mär 2008 11:42

Re: Form verschwindet nicht von Taskleiste trotz code !
 
Zitat:

Zitat von VnCoders
You cannot resize the Form Width to 0 with Form's BorderStyle is bsSizable. You should change it to bsNone.

Hey
That's not the problem. The Form Style is set to bsNone. The Problem is that the form is visible on the taskbar and the Code (what should make the button on the taskbar invisible) doesn't work on D2007 but i've tried it on D7 and there it works..

Sorry for my bad englisch :D

toms 25. Mär 2008 11:50

Re: Form verschwindet nicht von Taskleiste trotz code !
 
Hallo

Dies versteckt doch auch die Hauptform von der Taskleiste?

Delphi-Quellcode:
ShowWindow(Application.Handle, SW_HIDE);
Zudem: Sind wirklich 4 Timer nötig? Überdenke evtl. mal das Programmdesign.

dazar_t 25. Mär 2008 12:44

Re: Form verschwindet nicht von Taskleiste trotz code !
 
Nja die Timer sind inzwischen schon in funktionen "umgewandelt".

Aber der Code :
Delphi-Quellcode:
ShowWindow(Application.Handle, SW_HIDE);
Funktioniert ebend nicht...(Delphi 2007).
In D7 funktioniert es aber schon.

SirThornberry 25. Mär 2008 12:45

Re: Form verschwindet nicht von Taskleiste trotz code !
 
ich hab die Erfahrung gemacht dass, das Create-Event dafür ein schlechter Platz ist. Denn wenn danach noch ein Recreatewnd aufgerufen wird, so wird das Handle neu alociert und deine Änderungen werden nicht auf das neue Handle übertragen.

Bernhard Geyer 25. Mär 2008 12:49

Re: Form verschwindet nicht von Taskleiste trotz code !
 
Zitat:

Zitat von dazar_t
Funktioniert ebend nicht...(Delphi 2007).
In D7 funktioniert es aber schon.

Kann das u.U. mit dem geänderten verhalten hidden Application-Form bezüglich Vista-Support zusammenhängen :gruebel:

dazar_t 25. Mär 2008 12:50

Re: Form verschwindet nicht von Taskleiste trotz code !
 
Zitat:

Zitat von SirThornberry
ich hab die Erfahrung gemacht dass, das Create-Event dafür ein schlechter Platz ist. Denn wenn danach noch ein Recreatewnd aufgerufen wird, so wird das Handle neu alociert und deine Änderungen werden nicht auf das neue Handle übertragen.

Dankeschön habe es jetzt mal versetzt un nun funktioniert es..


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:34 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz