Bonsoir,

Apres quelques recherches sur le net non fructueuses je viens poser mon probleme


J'ai creer un programme qui lance des applications et je voudrai que ces applications soient lancer en Tray Icon ou sinon en mode reduit !!!

Si cela existe ( ce que je pense fortement car jen ai entendu parler) comment faire ??

Voila mon code source (fonctionnel pour le moment ):

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
48
49
50
51
52
53
54
55
56
57
58
59
60
 
//---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
 
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "trayicon"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
 
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
        STARTUPINFO         siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
 
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
if(CreateProcess(NULL,"C:\\Program Files\\Mozilla Firefox\\firefox.exe",0,0,FALSE,
                     CREATE_DEFAULT_ERROR_MODE,0,0,
                     &siStartupInfo,&piProcessInfo) == FALSE)
{
// erreur
}
else
{
   Sleep(15000); //attente 30 secondes
   // fermeture
   PostThreadMessage(piProcessInfo.dwThreadId, WM_QUIT, 0, 0);
   ::CloseHandle(piProcessInfo.hThread);
   ::CloseHandle(piProcessInfo.hProcess);
}
 
ShellExecute(NULL, //Handle de la fentetre parent
        "open", // Action a effectuer
        "C:\\Program Files\\messenger\\msn.exe", // Fichier
        "", // Parametres
        "", // repertoire par defaut
        SW_SHOWDEFAULT// Maniere d'afficher
        );
 
 
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::Button2Click(TObject *Sender)
{
        Close();        
}
//---------------------------------------------------------------------------
Merci pour votre attention a mon probleme !