当主窗体被激活时,用FindWindow   API查找你所调用的外部程序,
如存在就将外部程序置前Wnd:=FindWindow('xxx',nil);
if Wnd<>0 then
begin
     if isiconic(Wnd) then
       ShowWindow(Wnd,sw_restore)
     else
       SetForegroundWindow(Wnd);
end;