本帖最后由 lpp123456 于 2010-04-08 14:19:46 编辑

解决方案 »

  1.   

    参考:http://hi.baidu.com/w304/blog/item/2ac3da3ed1838cf9828b13b1.html
    function ExecAppWait(AppName, Params: string): Boolean;var// Structure containing and receiving info about application to startShellExInfo: TShellExecuteInfo;beginFillChar(ShellExInfo, SizeOf(ShellExInfo), 0);with ShellExInfo do begin    cbSize := SizeOf(ShellExInfo);    fMask := see_Mask_NoCloseProcess;    Wnd := Application.Handle;    lpFile := PChar(AppName);    lpParameters := PChar(Params);    nShow := sw_ShowNormal;end;Result := ShellExecuteEx(@ShellExInfo);if Result then    while WaitForSingleObject(ShellExInfo.HProcess, 100) = WAIT_TIMEOUT do    begin      Application.ProcessMessages;      if Application.Terminated then Break;    end;end;
      

  2.   

    在FORMCLOSE里遍历进程然后KILL掉
      

  3.   

    或 Windows.FindWindow(..) 然后发消息KILL掉
      

  4.   

    var
    h :HWND;  // 变成全局变量就行了然后在FORMCLOSE事件里写上SendMessage(h, WM_CLOSE, 0, 0);