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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
| unit Interface1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, ShellApi, Grids, MMSystem, Gauges;
type
TForm1 = class(TForm)
BPSTART: TButton;
BPRESTART: TButton;
BPSTOP: TButton;
ProgressBar1: TProgressBar;
Label1: TLabel;
BPIMPRIME: TButton;
BP5: TButton;
Button1: TButton;
Timer1: TTimer;
Choisir: TComboBox;
PrintDialog1: TPrintDialog;
OpenDialog1: TOpenDialog;
Button2: TButton;
BP6: TButton;
Button5: TButton;
Button3: TButton;
Button4: TButton;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure BP5Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BPIMPRIMEClick(Sender: TObject);
procedure BP6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure BPSTARTClick(Sender: TObject);
procedure BPSTOPClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
x : Integer ;
Edit1 : integer ;
OnKeyDown : Boolean ;
implementation
uses Unit2, Unit3;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('Interface crée par T.BENE pour un projet de QCM');
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
progressBar1.Position := ProgressBar1.Position+1 ;
//if ShellExecute(0,'OPEN','projet0.pps', Nil, Nil, SW_SHOW)
//MMRESULT timeSetEvent(3000 uDelay, 2 uResolution, 0 lpTimeProc, DWORD dwUser, TIME_PERIODIC fuEvent);
//if OnKeyDown
//then ProgressBar1.Position+1
//if ProgressBar1.Position= 10
//then close ;
//listBox1.Style := ListBox1.Style+1 ;
//do
//ProgressBar1.Position+1 for timer1 +10 ;
end;
procedure TForm1.BP5Click(Sender: TObject);
begin
ProgressBar1.Position := ProgressBar1.Position+1
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Close ;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Enabled := False ;
Form1.Position := poScreenCenter;
//Form1.WindowState := wsMaximized;
//Form1.WindowState := wsNormal;
//Form1.WindowState := wsMaximized ;
end;
procedure TForm1.BPIMPRIMEClick(Sender: TObject);
begin
//Form1.Print;
end;
procedure TForm1.BP6Click(Sender: TObject);
begin
Form2.Show;
Form2.WindowState := wsNormal;
end;
procedure TForm1.Button5Click(Sender: TObject);
//begin
//ShellExecute(0,'OPEN','TestComVox.exe', Nil, Nil, SW_SHOW);
//ShellExecute(0,'OPEN','gayyyy.pps', Nil, Nil, SW_SHOW);
//ShellExecute(0,'OPEN','projet0.pps', Nil, Nil, SW_SHOW)
Var StartInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
Fin : Boolean;
begin
{ Mise à zéro de la structure StartInfo }
FillChar(StartInfo,SizeOf(StartInfo),#0);
{ Seule la taille est renseignée, toutes les autres options }
{ laissées à zéro prendront les valeurs par défaut }
StartInfo.cb := SizeOf(StartInfo);
{ Lancement de la ligne de commande }
If CreateProcess(Nil, '"Station_meteo.exe"', NIL, Nil, False,
0, Nil, Nil, StartInfo,ProcessInfo) Then
Begin
{ L'application est bien lancée, on va en attendre la fin }
{ ProcessInfo.hProcess contient le handle du process principal de l'application }
Fin:=False;
Repeat
{ On attend la fin de l'application }
Case WaitForSingleObject(ProcessInfo.hProcess, 200)Of
WAIT_OBJECT_0 :Fin:=True; { L'application est terminée, on sort }
WAIT_TIMEOUT :; { elle n'est pas terminée, on continue d'attendre }
End;
{ Mise à jour de la fenêtre pour que l'application ne paraisse pas bloquée. }
Application.ProcessMessages;
Until Fin;
{ C'est fini }
ShowMessage('Terminé');
End
Else RaiseLastOSError;
End;
procedure TForm1.BPSTARTClick(Sender: TObject);
begin
//ListBox1.Items.Add('gay');
timer1.Enabled := true ;
//ShellExecute(0,'OPEN','gayyyy.pptx', Nil, Nil, SW_SHOW);
end;
procedure TForm1.BPSTOPClick(Sender: TObject);
begin
timer1.Enabled := false ;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Form3.ShowModal;
//Form3 := TForm3.Create(Self);
//Form3.Show();
//PrintDialog1.Execute;
//PrinterSetupDialog1.Execute;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
IF ShellExecute(Handle,'print','12.PDF',nil,nil,SW_HIDE) <=32 THEN ShowMessage(SysErrorMessage(GetLastError));
end;
end. |
Partager