- a coller apres le uses :
- Const WM_MYMESSAGE=WM_USER+100;
- ----------------------------------------------
- variables globales :
- notifyStruc:TNotifyIconData;
- --------------------------------------------------------
- //fonction qui minimize et cache la fenetre
- //declaration
- procedure Minimize(Sender: TObject);
- //corps de la fonction :
- procedure MACLASSE.Minimize(Sender: TObject);
- begin
- notifyStruc.cbSize:=SizeOf(notifyStruc);
- notifyStruc.Wnd:=Handle;
- notifyStruc.uID:=1;
- NotifyStruc.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
- NotifyStruc.uCallbackMessage := WM_MYMESSAGE;
- NotifyStruc.hIcon := WD_MAIN.Image1.Picture.Icon.Handle;//icone qui apparaitra dans le systray. composant Timage
- NotifyStruc.szTip:='le texte a afficher lorsque on passe la souris devant l'icone';
- Shell_NotifyIcon(NIM_ADD,@NotifyStruc);//ajoute la petite icône dans la barre des taches
- application.minimize;
- ShowWindow(Application.Handle, SW_HIDE); //application invisible de la barre de tâches.
- end;
- ----------------------------------------------------------
- //fonction qui restaure l'application: (a coller dans les déclaration de fonctions de classe)
- //declaration :
- procedure TrayMessage(var Msg: TMessage); message WM_MYMESSAGE;
-
- //corps de la fonction :
-
- procedure MACLASSE.TrayMessage(var Msg: TMessage);
- begin
- if (Msg.lparam=WM_LBUTTONDBLCLK) then //double click sur l'icone
- begin
- application.restore;
- ShowWindow(Application.Handle, SW_SHOW);
- if (@NotifyStruc<>NIL) then
- Shell_NotifyIcon(NIM_DELETE,@NotifyStruc); // supprime la petite icône de la barre des taches
-
- end;
- end;
a coller apres le uses :
Const WM_MYMESSAGE=WM_USER+100;
----------------------------------------------
variables globales :
notifyStruc:TNotifyIconData;
--------------------------------------------------------
//fonction qui minimize et cache la fenetre
//declaration
procedure Minimize(Sender: TObject);
//corps de la fonction :
procedure MACLASSE.Minimize(Sender: TObject);
begin
notifyStruc.cbSize:=SizeOf(notifyStruc);
notifyStruc.Wnd:=Handle;
notifyStruc.uID:=1;
NotifyStruc.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
NotifyStruc.uCallbackMessage := WM_MYMESSAGE;
NotifyStruc.hIcon := WD_MAIN.Image1.Picture.Icon.Handle;//icone qui apparaitra dans le systray. composant Timage
NotifyStruc.szTip:='le texte a afficher lorsque on passe la souris devant l'icone';
Shell_NotifyIcon(NIM_ADD,@NotifyStruc);//ajoute la petite icône dans la barre des taches
application.minimize;
ShowWindow(Application.Handle, SW_HIDE); //application invisible de la barre de tâches.
end;
----------------------------------------------------------
//fonction qui restaure l'application: (a coller dans les déclaration de fonctions de classe)
//declaration :
procedure TrayMessage(var Msg: TMessage); message WM_MYMESSAGE;
//corps de la fonction :
procedure MACLASSE.TrayMessage(var Msg: TMessage);
begin
if (Msg.lparam=WM_LBUTTONDBLCLK) then //double click sur l'icone
begin
application.restore;
ShowWindow(Application.Handle, SW_SHOW);
if (@NotifyStruc<>NIL) then
Shell_NotifyIcon(NIM_DELETE,@NotifyStruc); // supprime la petite icône de la barre des taches
end;
end;