var
 hMutex:HWND; //程序互斥对象句柄
 Ret:Integer; //返回的错误句柄begin
 Application.Initialize;
 Application.Title := 'aaaaa';
 hMutex := CreateMutex(nil,False,'aaaaa');
 Ret:=GetLastError;
 if Ret<>ERROR_ALREADY_EXISTS then
 Begin
   Application.CreateForm(TForm1, Form1);
   Application.Run;
 End
 else
   //Application.MessageBox('程序已经运行!','提示!',MB_OK);
   EnableWindow(hMutex,true);
 ReleaseMutex(hMutex);
end.