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
|
program Project1;
uses
Forms,
Windows, //Ajout de l'unité "Windows" pour la fonction sleep
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
Form2 := TForm2.Create(Application); //Crée la fenêtre Form2
try
Form2.Show; //Affiche Form2
Application.Initialize;
Form2.Refresh; //Redessine Form2
Sleep(3000); //Attend 3 secondes
// Mais pendant ce temps-là les instructions de Unit1 ne s'exécutent pas.
// Or, c'est ce que je voulais : ce n'était pas simplement décoratif...
Application.CreateForm(TForm1, Form1);
Form2.Hide; //Cache la form2
finally
Form2.Free; //Libère Form2
end;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end. |
Partager