var
mutexhandle: integer;
processid: thandle;
thewindow: dword;
begin
if OpenMutex(MUTEX_ALL_ACCESS,false,'runoncemutex') <> 0 then
begin
thewindow := FindWindow('TForm1','Form1');
// GetWindowThreadProcessId(thewindow,@processid);
// OpenProcess(PROCESS_ALL_ACCESS,false,processid);
ShowWindow(thewindow,SW_RESTORE);
Application.Terminate;
exit;
end;
mutexhandle := CreateMutex(nil,true,'runoncemutex');
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
ReleaseMutex(mutexhandle);
end.
我这样写了,不过再点击一字时他还是不能像点击任务栏那样弹出。请高手们帮帮