procedure setAppFront(); //使程序的窗口出现在最前面并激活 var pt, OldPt, NewPt: TPoint; begin //判断Application是否最小化,而不是主窗口的Handle, 使用Restore来还原 if IsIconic(Application.Handle) then Application.Restore; SetWindowPos(Application.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_N