Autor Beitrag
schlumsch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

alles Win :)
Delphi 2005 Prof, Delphi 2007
BeitragVerfasst: Di 29.12.09 00:32 
Hallo allerseits,

ich habe ein Programm geschrieben und minimiere dieses erfolgreich in die
Tray mit Icon. Nun habe ich allerdings das Problem, dass mir zusätzlich zu meuinem Icon in der Tray immernoch das Programm in der Symbolleiste angezeigt wird, eben so also ob ich es "normal" minimiert hätte. Komischerweise funktioniert mein Code in einem anderen meiner Programme wunderbar, (wie) kann ich explizit den Eintrag in der Symbolleiste entfernen??

Hier mein Code für die TApplication.minimize:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
begin
  Form1.Hide;
  with NIM do begin
    cbSize := SizeOf (nIM);
    Wnd := Handle;
    uID := 0;
    uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
    uCallbackMessage := IC_CLICK;
    hIcon := Application.Icon.Handle;
    szTip := 'wpcstf';
  end;
  Shell_NotifyIcon(NIM_ADD, @NIM);
end;


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 03.01.2010 um 13:39

_________________
icq 102779206
"God is real, unless declared integer..."
MaPsTaR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90
Erhaltene Danke: 4

Win XP
Delphi 7 Enterprise
BeitragVerfasst: Sa 02.01.10 18:39 
Nimm mal diesen Code:

www.delphi-treff.de/...kleiste%20entfernen/

Bei mir funktioniert das so.

edit:

Oder du entfernst die Schaltfläche damit.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  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);


Unter welchem Windows läuft denn das Programm. Hab jetzt mal gelesen, dass diese Funktion unter Win7 nicht funktioniert.

_________________
Liebe Kinder, es stimmt ... solnage auch nur der ertse und lezte Bchutsabe rihctig ist und alle andreen Bcuhsatben irgendwie vorahnden sind,
dann knan man es dennonch lesen, also macht nur weiter so, wir verstehen euch schon
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19276
Erhaltene Danke: 1741

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 02.01.10 18:59 
Der Code mit Application.Handle funktioniert allerdings nur bis Delphi 2006. Mit Delphi 2007 wurde der Designfehler behoben, seitdem liegt in der Taskleiste nicht mehr das versteckte Application-Fenster sondern es liegen dort die Formulare selbst.

Der Grund für diese Umstellung war unter anderem, dass sonst die Vorschaufunktion in der Taskleiste ab Windows Vista nicht funktioniert.

Das heißt aber, dass ab Delphi 2007 der Code auf die Fenster selbst angewendet werden muss.
schlumsch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

alles Win :)
Delphi 2005 Prof, Delphi 2007
BeitragVerfasst: Mo 04.01.10 12:54 
Ich hab eine Komponente gefunden welche mir das ganze "abnimmt" :) Funktioniert Klasse, vielleicht interessiert es ja jemanden:
swissdelphicenter.ch...showcode.php?id=1303.

ansonsten mal lg & thx

_________________
icq 102779206
"God is real, unless declared integer..."
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 17.02.10 21:35 
Falls jemand diesen Thread findet, weil das mit dem Taskleisten-Eintrag ausblenden doch nicht funktioniert:

Ich hatte hier grade den Fall, dass ein älteres (in D7 entwickeltes) Programm bisher mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
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);

auch unter D2009 eigentlich so funktioniert hat, was unter Windows 7 zu gewissen Problemen geführt hat, wie jaenicke weiter oben erwähnt hat

Ein Umstellen auf
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
ShowWindow(MainForm.Handle, SW_HIDE); 
SetWindowLong(MainForm.Handle, GWL_EXSTYLE, 
GetWindowLong(MainForm.Handle, GWL_EXSTYLE) 
    or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW); 
ShowWindow(MainForm.Handle, SW_SHOW);

hat aber nicht funktioniert (auch ohne die letzte Zeile ;-)).

Und zwar weil: In der Project.dpr muss man in so einem Fall (altes Projekt in neuer IDE weiterentwickeln) eine Zeile hinzufügen:
ausblenden Delphi-Quelltext
1:
2:
Application.Initialize;
Application.MainFormOnTaskBar := True;

Denn erst damit liegt in der Taskleiste das MainForm.Handle. Erstellt man ein neues Projekt in der neuen IDE, wird diese Zeile automatisch hinzugefügt.

Danke, weitergehen. :D

_________________
We are, we were and will not be.