از کد زیر استفاده کنید.
program Project1;
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
function I:boolean;
var
H,HH:Thandle;
begin
H:=CreateMutex(nil,False,'OneCopyMutex');
result:=false;
If not(WaitForSingleObject(H,0)<>Wait_TimeOut) then
result:=true;
end;
var hh:Thandle;
begin if not i then begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end
else
begin
messageDlg('Another Copy Of Application Is Already Running', mtinformation,[mbOk], 0);
HH:= FindWindow(nil, 'Form1');
SendMessage(HH, wm_SysCommand, SC_RESTORE, 0) ;
end;
end.