program Doll;<br><br>uses<br> Windows,<br> Forms,<br> Unit1 in 'Unit1.pas' {Form1};<br><br>{$R *.res}<br>var<br>MutexHandle:Hwnd;<br>begin<br> Application.Initialize;<br> MutexHandle:=CreateMutex(nil,false,Pchar('MyMutex'));<br><br> if GetLastError<>ERROR_ALREADY_EXISTS then<br> begin<br> Application.CreateForm(TForm1, Form1);<br> Application.Run;<br> end<br> else<br> MessageBox(0,Pchar('程序已经运行'),'警告' ,MB_OK + MB_ICONWARNING);<br> ReleaseMutex(MutexHandle);<br>end.