program Project1; uses Forms, Windows, Sysutils, Messages, unit1 in 'unit1.pas' {Form1}; Var ClassName : Array[0..255] of char; result : integer; {$R *.RES} begin Application.Initialize; Application.Title := 'Start'; GetClassName(Application.handle, ClassName, 254); { renvoie le Handle de la première fenêtre de Class (type) ClassName et de titre Application.Title (0 s'il n'y en a pas)} result := FindWindow(ClassName, 'Onlyone'); if result <> 0 then // Une instance existante trouvée begin ShowWindow(result, SW_RESTORE); SetForegroundWindow(result); Application.Terminate; end else // Première création begin Application.Title := 'Onlyone'; Application.CreateForm(TForm1, Form1); Application.Run; end; end.