Autor Beitrag
HeftCD
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 91
Erhaltene Danke: 9

Win2k, WinXP, Win7, Win8
Delphi 3 Pro, Delphi 5, Delphi 7, Turbo Delphi, BC1
BeitragVerfasst: Sa 20.11.10 14:54 
Hallo.

Folgender Code soll die Form 2 permanent in den Vordergrund bringen.

ausblenden Delphi-Quelltext
1:
SetWindowPos(Form2.Handle, HWND_TOPMOST, 0000, SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE);					



Dort bleibt sie aber nur so lange, bis ich ein anderes Programm in der Taskleiste anklicke.
Klicke auf mein Programm zurück ist sie parallel zu meiner Form 1 auch wieder im Vordergrund.


Aber das kann doch nicht alles sein, oder?
Was läuft denn da falsch?

Moderiert von user profile iconMartok: Delphi-Tag gesetzt
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Sa 20.11.10 14:57 
Es gibt dochden FormStyle
fsStayOnTop
Warum benutzt du nicht den? Ist sogar ne Eigenschaft von den Forms.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 20.11.10 15:06 
user profile iconHeftCD hat folgendes geschrieben Zum zitierten Posting springen:
Folgender Code soll die Form 2 permanent in den Vordergrund bringen.
Davon sehe ich nichts. Dein Code setzt das Fenster in diesem Moment auf die vorderste Position in der Z-Order.

Das heißt aber nicht, dass es permanent immer wieder nach vorne gebracht wird. Sondern eben nur, wenn du das mit der Zeile auslöst.

Wenn es permanent vorne bleiben soll, musst du den Fensterstil verändern. Entweder manuell oder mit dem genannten Wert fsStayOnTop. Wenn aber ein anderes Fenster auch OnTop sein soll, dann kann das eben mittels des obigen Codes vor dein Fenster gelangen.

Dagegen kannst du natürlich auch nichts machen. Denn zweimal "ganz ganz vorne" gibt es eben rein logisch nicht. :nixweiss:
HeftCD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 91
Erhaltene Danke: 9

Win2k, WinXP, Win7, Win8
Delphi 3 Pro, Delphi 5, Delphi 7, Turbo Delphi, BC1
BeitragVerfasst: Sa 20.11.10 15:55 
ja, danke - super ... damit klappt's.

Form2.FormStyle := fsStayOnTop;



Klar, daß ein anderes Fenster das das "nach mir" anmeldet noch "eins weiter davor" kommen könnte.
Aber mir reicht das schon, wenn das überhaupt im Vordergrund bleibt.
Das einzige, was ich fand war meine Codezeile ... oben.
naja, und das wirkte ja auch für sämtliche Forms innerhalb meines Programms. :D