用互拆吧
program Project1;
uses
Forms,
Windows,
Unit1 in 'Unit1.pas' {Form1};
{$R *.RES}
begin
if OpenMutex(MUTEX_ALL_ACCESS,True,'Projectabc')>0 then
begin
MessageBox(0,'程序已经在运行','错误',MB_OK);
end
else begin
CreateMutex(nil,True,'Projectabc');
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
CloseHandle(OpenMutex(MUTEX_ALL_ACCESS,True,'Projectabc'));
end;
end.