Autor Beitrag
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 22.05.07 15:29 
Moin!

Ich habe mich schon ausschweifend mit den mageren Suchergebnissen rumgeschlagen, aber es will mir einfach nicht gelingen, ein Fenster dauerhaft "oben" zu halten, also z.B. so wie die Notizzettel von ATnotes, falls das einer kennt. ;) Mehr API-gerechte Formulierung: ein Fenster in die Gruppe der TopMost-Windows zu packen und auch dort anzunageln! :evil: Hab schon sehr ausführlich das MSDN durchforstet :les: aber mehr als den ominösen Hinweis auf die beiden Fenstergruppen (TopMost- und NonTopMost-Windows), sowie das Procedere per SetWindowLong/SetWindowPos konnte ich nicht finden. :|

Es gelingt mir, ein Fenster in diesen Zustand zu versetzen, allerdings nur "ein mal" :arrow: beim zweiten Focuswechsel ist es dann doch wieder verdeckt... :(

Hab mir gedacht, dass es sicherlich mit dem versteckten Application-Window einer VCL-Anwendung zu tun hat, deshalb habe ich zunächst mal dieses versucht, nach "oben" zu befördern - wie gesagt, klappt auch - ein mal... :cry:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TfrmInfo.FormShow(Sender: TObject);
begin
  SetWindowLong(Application.Handle,
                GWL_EXSTYLE,
                GetWindowLong(Application.Handle,GWL_EXSTYLE) or WS_EX_TOPMOST);
  SetWindowPos(Application.Handle,
               HWND_TOPMOST,
               0, 0, 0, 0,
               SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
  SetForegroundWindow(Self.Handle);
end;

Any Hints?! :flehan:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 22.05.07 16:05 
Vielleicht ist das hier besser:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
//Keepontop
SetWindowPos(Handle,HWND_TOPMOST, 0, 0, 0, 0,SWP_NOMOVE + SWP_NOSIZE);
//KeepNOTontop
SetWindowPos(Handle,HWND_NOTOPMOST, 0, 0, 0, 0,SWP_NOMOVE + SWP_NOSIZE);
Narses Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 22.05.07 16:10 
Moin!

Danke für den Tipp, aber leider - gleicher Effekt. :(

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Di 22.05.07 22:40 
hi

versuchs mal so, vielleicht liegts am Handle, den ich nicht so ganz verstehe

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormShow(Sender: TObject);
 begin
  with Self do
   SetWindowPos(Handle,
   HWND_TOPMOST,
   0,
   0,
   0,
   0,
   SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
  end;


Bei mir hat astrein funktioniert

Gruß

Aga
Narses Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 22.05.07 23:11 
Moin!

Danke für den Tipp und du hast Recht, für das Hauptformular ist das tatsächlich so, es bleibt "oben". ;) Allerdings... :? ist es etwas komplizierter, denn ich brauche diesen "Effekt" nicht für das Hauptformular, sondern für, sagen wir mal Form2! :| Und da klappt´s leider immer noch nicht (hat eben nur den gleichen Effekt, wie fsStayOnTop). :nixweiss:

Ich habe mal mein Testprojekt angehangen, damit´s etwas klarer wird.

Weitere Tipps? :(

cu
Narses
Einloggen, um Attachments anzusehen!
_________________
There are 10 types of people - those who understand binary and those who don´t.
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mi 23.05.07 00:45 
ist form1 dein unsichtbares fenster?

ist ja mal wirklich verblüffend.
Es sieht so aus, als wenn Mama-fenster alles darf, sich auch in den Vordergrund drängen, aber die Kinder dürfen das nicht, selbst wenn progger-papa ihnen das erlaubt, mama-fenster macht das sofort wieder ungültig, hält sich aber brav im Hintergrund, wenn sie nicht oben bleiben soll und versteckt sich auch, wenn progger-papa das sagt.

Mal ein bissel gegoogelt und das hier gefunden

geht dann wohl schon ins eingemachte

groups.google.com/gr...580/85242b2f0e4b8a12

Also ich vermute, man wird die message von mama-fenster irgendwie unterdrücken müssen, die die Kinderfenster normalisiert.

ich probier noch mal ein bissi, aber so in Sek wird das nix, hehe

Gruß

Aga

//Edit
Bevor man jetzt in der Windows-Api + VCL rumwühlt, was hindert Dich daran, das ans Kreuz, ahem Fenster zu nagelnde Fenster zum Main-Fenster zu machen?
Narses Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 23.05.07 07:49 
Moin!

Danke für die Infos. ;)

user profile iconAgawain hat folgendes geschrieben:
ist form1 dein unsichtbares fenster?

Yip.

user profile iconAgawain hat folgendes geschrieben:
ist ja mal wirklich verblüffend.

:)

user profile iconAgawain hat folgendes geschrieben:
Bevor man jetzt in der Windows-Api + VCL rumwühlt, was hindert Dich daran, das ans Kreuz, ahem Fenster zu nagelnde Fenster zum Main-Fenster zu machen?

MainDialog schließen :arrow: Programm schließen... :?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Narses Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 23.05.07 22:52 
Moin!

Da eine eigenschaftenbasierte Lösung offensichtlich nicht möglich oder jedenfalls sicher nicht ganz einfach ist, hier mein "Workaround", der zumindest bei ausgeblendetem MainForm (=Form1) für Form2 das gewünschte Resultat liefert: :|
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm2.FormShow(Sender: TObject);
begin
  Application.OnDeactivate := ApplicationDeactivate;
end;

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Application.OnDeactivate := NIL;
end;

procedure TForm2.ApplicationDeactivate(Sender: TObject);
begin
  SetWindowPos(TForm2.Handle,
               HWND_TOPMOST,
               0, 0, 0, 0,
               SWP_NOMOVE or SWP_NOSIZE);
end;

Falls jemand doch noch eine "bessere" Lösung kennt, bitte trotzdem noch antworten! ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.