那为何我下面的这段代码没有反应??
连ShowMessage都没执行??procedure TForm1.Button1Click(Sender: TObject);
var
  hwnd:THandle;
begin
  hwnd:=FindWindow(nil,'NetCaptor');
  if hwnd<>0 then
    SetActiveWindow(hwnd)
  else
    ShowMessage('Don"t find the Window');end;

解决方案 »

  1.   

    那就是找到了。不过你应该用 SetForegroundWindow看看。
      

  2.   

    你应该用SetForegroundWindow(hwnd);来把程序提 到前面来
      

  3.   

    SetForegroundWindow只在NetCaptor窗体未最小化时有用,一旦NetCaptor最小化,他就没用了,还有什么办法吗?
      

  4.   

    SetForeground只有在非最小化时,NetCaptor才能显现出来,一旦NetCaptor最小化,就不管用了,请问还有什么方法?
      

  5.   

    var outerwinfrm:HWnd;
    begin
      winexec(pchar('c:\rups2w\Rups2w.exe'),SW_SHOW);
      Sleep(1000);
      // find the exist window
      outerwinfrm := FindWindow(nil, 'RUPS II for Windows');
      // Active the window
      if outerwinfrm = 0 then
      begin
         Application.MessageBox('请先安装UPS监控软件!!!','警告',mb_Ok+mb_iconwarning);
         exit;
      end;
      ShowWindow(outerwinfrm,SW_Restore);
      SetActiveWindow(outerwinfrm);
      BringWindowToTop(outerwinfrm);
      freelibrary(outerwinfrm);//***********************************************
    anyhelp?hehehe
      

  6.   

    thank you!你们解决我的疑问,结贴!