建一个Mutex来互斥
procedure TForm1.FormCreate(Sender: TObject);
Var Ret:Integer;
begin
CreateMutex(nil,False,'aaaaaa');
Ret:=GetLastError;
; if Ret = ERROR_ALREADY_EXISTS Then begin
; ; ;Application.MessageBox('已经运行', '重复运行', MB_OK + MB_ICONEXCLAMATION);
; ; ;Application.Terminate;
; end;
end;