昨天才写的:在工程起动时判断,'Logon'为exe文件的caption,也就是在任务栏里显示的标题<br>program Project1;<br><br>uses<br> Forms,Windows,Dialogs,SysUtils,<br> Unit1 in 'Unit1.pas' {Form1},<br><br>{$R *.res}<br>var<br> MutexH,FwH: THandle;<br><br>begin<br> MutexH := CreateMutex(nil,True,'Logon');<br> if MutexH<>0 then<br> begin<br> if GetLastError = ERROR_ALREADY_EXISTS then<br> begin<br>// Application.MessageBox('程序已经运行','提示',MB_OK);<br> FwH := FindWindow(nil,'Logon');<br> if FwH <>0 then<br> begin<br> ShowWindow(FwH,SW_RESTORE);<br> end;<br>// Format('MutexH=%d,FwH=%d',[MutexH,FwH]);<br> ShowMessage(Format('MutexH=%d,FwH=%d',[MutexH,FwH]) );<br> CloseHandle(FwH);<br> ReleaseMutex(MutexH);<br> Exit;<br><br> end;<br><br> end;<br><br> Application.Initialize;<br> Application.Title := 'Logon';<br> Application.CreateForm(TForm1, Form1);<br>// Application.MessageBox('sdf','information',MB_OK);<br> Application.Run;<br><br>end.