bonjour a tous je désire savoir
- comment faire pour minimiser mon programme (icône cacher) tel que (IDM - UTORRENT ....)
- est il possible de l’exécuter automatiquement au démarrage du pc (par delphi pas par windows msconfig )
et merci
bonjour a tous je désire savoir
- comment faire pour minimiser mon programme (icône cacher) tel que (IDM - UTORRENT ....)
- est il possible de l’exécuter automatiquement au démarrage du pc (par delphi pas par windows msconfig )
et merci
NotifyIcon soit celui de la JEDI soit directement via l'API Shell_NotifyIcon
Il doit y avoir maintenant le TTrayIcon en VCL native selon la version (je l'ai en D10 Seattle) et c'est même avec un exemple dans la documentation, si tu poses la question, je devine un vieux Delphi, genre Delphi 7 ou c'est plus "brut" dont voici un code qui a 20 ans (pas terrible d'ailleurs) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 procedure TNotifyTaskBar***Form.CreateNotifyIcon(DoAdd: Boolean = True; const AlternateMsg: string = ''; DoAlert: Boolean = False; DoPause: Boolean = False); const NIF_INFO = $00000010; NIIF_INFO = $00000001; var ResultIcon: TIcon; BarTaskString: string; begin ResultIcon := TIcon.Create(); try InternalNotifyIconData.cbSize:= SizeOf(InternalNotifyIconData); // ShellAPI.TNotifyIconData InternalNotifyIconData.Wnd:= Handle; InternalNotifyIconData.uID:= 1; InternalNotifyIconData.uFlags:= NIF_ICON or NIF_TIP or NIF_MESSAGE; InternalNotifyIconData.uCallbackMessage := WM_MYNOTIFYEVENT; if DoAlert then ResultIcon.Assign(ImageActive.Picture.Icon) else ResultIcon.Assign(Application.Icon); if DoPause then ResultIcon.Assign(ImagePause.Picture.Icon); InternalNotifyIconData.hIcon := ResultIcon.Handle; BarTaskString := Application.Title + AlternateMsg; ZeroMemory(@InternalNotifyIconData.szTip[0], Length(InternalNotifyIconData.szTip)); CopyMemory(@InternalNotifyIconData.szTip[0], @BarTaskString[1], Length(BarTaskString)); InternalNotifyIconData.szTip[Length(InternalNotifyIconData.szTip)-1]:= #0; // Garanti le Zéro Terminal même si Application.Title est plus long if DoAdd then Shell_NotifyIcon(NIM_ADD, @InternalNotifyIconData) else Shell_NotifyIcon(NIM_MODIFY, @InternalNotifyIconData); finally ResultIcon.Free(); end; end; procedure TNotifyTaskBar***Form.DestroyNotifyIcon(); begin if (@InternalNotifyIconData <> nil) then begin Shell_NotifyIcon(NIM_DELETE, @InternalNotifyIconData); //retire la petite icône de la barre des taches end; end;
Base de Registre, SOFTWARE\Microsoft\Windows\CurrentVersion\Run mais pourquoi ne pas plutôt songer à un Service ?
HKEY_LOCAL_MACHINE ou HKEY_CURRENT_USER selon si c'est global ou à l'utilisateur
PS : Pourquoi ton texte est-il écrit en grand ?![]()
Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !![]()
Attention Troll Méchant !
"Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
L'ignorance n'excuse pas la médiocrité !
L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
Il faut avoir le courage de se tromper et d'apprendre de ses erreurs
je vous remercie pour votre aidePS : Pourquoi ton texte est-il écrit en grand ?![]()
j'utilise delphi 10.3
mon texte est écrit en grand pour que j'arrive a le lire![]()
Partager