- //mettez ce code dans formcreate
- 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 := Form1.Image1.Picture.Icon.Handle;//icone qui apparaitra dans le systray.
- NotifyStruc.szTip:='Nom du programme';
- Shell_NotifyIcon(NIM_ADD,@NotifyStruc);//ajoute la petite icône dans la barre des taches
-
-
- procedure TForm1.TrayMessage(var Msg: TMessage);//procedure pour les action sur l'icone
- begin
- if (Msg.LParam=WM_RBUTTONDOWN) then ShowMessage('Bouton droit pressé!');
- if (Msg.LParam=WM_LBUTTONDOWN) then {WM_LBUTTONDOWN = Bouton gauche}end;
- end;
-
- //dans formclose :
- if (@NotifyStruc<>NIL) then
- Shell_NotifyIcon(NIM_DELETE,@NotifyStruc); // supprime la petite icône de la barre des taches
//mettez ce code dans formcreate
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 := Form1.Image1.Picture.Icon.Handle;//icone qui apparaitra dans le systray.
NotifyStruc.szTip:='Nom du programme';
Shell_NotifyIcon(NIM_ADD,@NotifyStruc);//ajoute la petite icône dans la barre des taches
procedure TForm1.TrayMessage(var Msg: TMessage);//procedure pour les action sur l'icone
begin
if (Msg.LParam=WM_RBUTTONDOWN) then ShowMessage('Bouton droit pressé!');
if (Msg.LParam=WM_LBUTTONDOWN) then {WM_LBUTTONDOWN = Bouton gauche}end;
end;
//dans formclose :
if (@NotifyStruc<>NIL) then
Shell_NotifyIcon(NIM_DELETE,@NotifyStruc); // supprime la petite icône de la barre des taches