大家好,怎样使installshield6.22打包的安装程序,在卸载之前执行一个命令如:regservice.exe -unreg,谢谢!
请大家帮帮忙,谢谢!急。。

解决方案 »

  1.   

    添上下面的脚本就可以实现卸载之前运行一个程序////////////////////////////////////////////////////////////////
    ///////////          CloseSoftware                    //////////
    //////////////////////////////////////////////////////////////// 
    function CloseSoftware()
    STRING szProgram, szCmdLine;
    NUMBER nResult;
    begin
    szProgram = TARGETDIR^"\\CloseProcess.exe";
    szCmdLine = ""; 

    if (LaunchApp(szProgram, szCmdLine) < 0) then 
            MessageBox("Close SoftWare Error!", SEVERE);
        else
         return 0;
        endif;
        
        return 0;
    end;function OnMaintUIBefore()
        STRING svResult,szCaption;
        NUMBER nResult;
    begin
       // TO DO:   if you want to enable background, window title, and caption bar title   
       // SetTitle( @TITLE_MAIN, 24, WHITE );
       // SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );  
       // SetColor(BACKGROUND,RGB (0, 128, 128));
       // Enable( FULLWINDOWMODE );
       // Enable( BACKGROUND );

        //Maintenance Mode
        CloseSoftware();
        svResult = SdLoadString(IFX_MAINTUI_MSG);
        szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
       nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
       if (nResult = IDCANCEL) then
           exit;
       elseif(nResult = IDOK) then
           // setup default status
            SetStatusWindow(0, "");
            Enable(STATUSEX);
            StatusUpdate(ON, 100);        //-->Remove all components
           ComponentRemoveAll();
        endif;
            DeleteDir(TARGETDIR,ALLCONTENTS);
    DeleteDir(TARGETDIR,ONLYDIR);
        return 0;
    end;
      

  2.   

    请帮我看看,
    function OnUninstallingFile(szFile)  
    STRING strAgentFile,strComFile;
    begin    
    strAgentFile = TARGETDIR^"agent.exe";
    strComFile = TARGETDIR^"stdcom.dll";
    if (StrCompare(szFile,strComFile) = 0||StrCompare(szFile,strAgentFile) = 0) then
    LaunchAppAndWait(TARGETDIR^"regservice.exe","-unreg",WAIT);  
       endif;
    end; 
    这么写为什么不成功。谢谢!
      

  3.   

    我添加了这个
    function CloseSoftware()
    STRING szProgram, szCmdLine;
    NUMBER nResult;
    begin
    szProgram = TARGETDIR^"\\regservice.exe";
    szCmdLine = "-unreg"; 

    if (LaunchApp(szProgram, szCmdLine) < 0) then 
            MessageBox("Close SoftWare Error!", SEVERE);
        else
         return 0;
        endif;
        
        return 0;
    end;
    编译不通过,找不到CloseSoftware。提示:
    Compiling...
    Folder: <C:\My Installations\代理服务监控制\Script Files>
    Setup.Rul(121): error C8003: 'CloseSoftware' : function has no prototype declaration 
    Setup.Rul(131): error C8087: cannot return value from program 
    Setup.Rul(134): error C8087: cannot return value from program 
    Done-  3 error(s), 0 warning(s)我改怎么办?谢谢你!
      

  4.   

    脚本的最前面加入下面语句
    prototype CloseSoftware();
      

  5.   

    谢谢!
    我是这样做的
    我在function OnMaintUIBefore() 下加入
    LaunchAppAndWait(TARGETDIR^"regservice.exe","-unreg",WAIT);
    加入这个就可以了!
    谢谢随便看看!