1.
//置前
SetWindowPos(form1.handle,HWND_TOPMost,form1.left,form1.top,form1.width,form1.heigth,0);
//取消置前
SetWindowPos(form1.handle,HWND_NOTOPMost,form1.left,form1.top,form1.width,form1.heigth,0);
2.对于MessageBoxMessageBox(0,'该程序已经在运行...','警告',MB_SYSTEMMODAL);
begin
Application.Initialize;
if not AppHasRun(Application.Handle) then
Application.CreateForm(TForm1, Form1)
else
begin
MessageBox(0,'该程序已经在运行...','警告',MB_SYSTEMMODAL);
Application.Terminate;
end
end.