Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Application.MainForm.Show & TForm1.Minimize (https://www.delphipraxis.net/113034-application-mainform-show-tform1-minimize.html)

sk0r 1. Mai 2008 17:16


Application.MainForm.Show & TForm1.Minimize
 
Hi,

ich möchte meine Anwendung ins Systemtray befördern, sobald
man auf "Minimieren" klickt. Per Rechtsklick auf das Trayicon
zeigt sich das Programm wieder. Das Problem ist, dass das Programm
dann aber eigentlich noch den minimierten Status hat, obwohl es
gezeigt wird. Deshalb reagiert dann der Minimiere-Button nicht mehr,
solange bis ich mit Rechtsklick->Wiederherstellen das Programm
wieder hergestellt habe.

Weiß jemand, wie ich das Problem lösen kann?
Danke schon mal für Hilfe im Vorraus.

MfG: sk0r

toms 1. Mai 2008 18:05

Re: Application.MainForm.Show & TForm1.Minimize
 
Hallo,

Wie "minimierst" du ins TNA?

sk0r 1. Mai 2008 18:14

Re: Application.MainForm.Show & TForm1.Minimize
 
Hi,

Delphi-Quellcode:
procedure TForm1.AppMinimize(Sender: TObject);
begin
  TrayIcon.cbSize := sizeof(TrayIcon);
  TrayIcon.Wnd := Handle;
  TrayIcon.uID := 0;
  TrayIcon.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
  TrayIcon.uCallbackMessage := WM_TRAYICON;
  TrayIcon.hIcon := Application.Icon.Handle;
  TrayIcon.szTip := 'Name';
  Shell_NotifyIcon(NIM_ADD, @TrayIcon);
  Application.MainForm.Hide;
end;
MfG: sk0r


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:37 Uhr.

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