用ShellExecute 打开一个IE页面后,IE成了被激活的窗体了,如何在程序中打开一个IE连接后,让程序仍然保持激活状态。愁啊,兄弟们!

解决方案 »

  1.   

    你在ShellExecute 之后,加上下面的代码:
    SetForegroundWindow(Handle);
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShellExecute(self.Handle,'open','http://community.csdn.net/Expert/topic/4692/4692400.xml?temp=.702984','','',SW_SHOWNOACTIVATE);
      BringToFront;
    end;
      

  3.   

    procedure SwitchToThisWindow(h1: hWnd; x: bool); stdcall;
      external user32 Name 'SwitchToThisWindow';
             {x = false: Size unchanged, x = true: normal size}
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      ShellExecute(.......
      ...  Application.ProcessMessage;   SwitchToThisWindow(FindWindow('notepad', nil), True);
    end;
      

  4.   

    SwitchToThisWindow(Application.Handle, true);
      

  5.   

    handle: THandle;
    begin
      ShellExecute(Handle,'open',pchar('http://mail.tom.com'), '','',SW_SHOWNOACTIVATE);  handle := GetActiveWindow;  sleep(1000);
      //handle := GetForegroundWindow;
      SetForegroundWindow(handle);
    我搞定了。谢谢各位了
      

  6.   

    to:aiirii(ari-http://spaces.msn.com/members/aiirii/)
    这个函数是API嘛,我怎么无法使用呢?