Var<br> hMutex:HWND;<br> Ret:Integer;<br> begin<br> Application.Initialize;<br> Application.Title := '我的程序;<br> hMutex:=CreateMutex(nil,False,'我的程序');<br> Ret:=GetLastError;<br> If Ret<>ERROR_ALREADY_EXISTS Then<br> Begin<br> Application.CreateForm(Tmain, main);<br> Application.Run;<br> End<br> Else<br> MessageBox(application.handle,'程序已经启动,无需再次运行','提示',MB_ICONASTERISK or MB_OK);<br> ReleaseMutex(hMutex);<br> end.<br><br>