请问用Delphi怎么做呢高分:请问我有两个安装程序我想在第一个安装程序,安装完以后。再执行第二个安装程序。

解决方案 »

  1.   

    var
       pWindowsList: pointer;
       hActiveWindow: HWnd;
       hExeHandle: THandle;
    begin
       pWindowsList := DisableTaskWindows(0);
       hActiveWindow := GetActiveWindow;
       try
          hExeHandle := WinExec(setup1.exe',SW_SHOWNORMAL);//执行第一个安装程序
          while GetModuleUsage(hExeHandle) <> 0 do
          Application.ProcessMessages;
       finally
          EnableTaskWindows(pWindowsList);
          SetActiveWindow(hActiveWindow);
       end;
      //执行第一个程序,直到它结束以后再返回,这时可以执行第二个安装程序
      try
          hExeHandle := WinExec(setup2.exe',SW_SHOWNORMAL);//执行第二个安装程序
          while GetModuleUsage(hExeHandle) <> 0 do
          Application.ProcessMessages;
       finally
          EnableTaskWindows(pWindowsList);
          SetActiveWindow(hActiveWindow);
       end;
      //两个安装程序执行完毕,程序可以返回,如果需要退出,只需要加上以下代码: 
      //application.Terminate;  
    end;
      

  2.   

    不知道你是用什麼製作安裝包的,我用wise,installExpress都可以啊,例如,安裝完程序後再安裝微軟的 mdac2.7,就是這樣的啊!