InstallShield 工程类型installscript,如何覆盖安装?

原文 http://www.cnblogs.com/daocaorenbx/p/3305162.html

开始使用的msi工程类型。网上找了资料, 在kevin的博客里找到这条方法 可以通过删除Execute Sequence中的RegisterProduct和PublishProduct两个CA实现同样的需求

试过之后确实是可以 重复安装的,但是 开始菜单的中的卸载是无法卸载的,而且控制面板是不能显示该程序的。所以此方法不可行。

换了个工程类型,使用 installscript工程类型,此类型的 脚本中 advanced下面有个 OnShowUI,即存放的检测是已安装、更新、还是第一次安装 的脚本,修改逻辑第一安装外的情况 继续执行 安装脚本 

在 卸载的快捷方式中添加一个参数 -removeonly,检测判断此参数为卸载功能。

修改代码如下: 

 

复制代码
function OnShowUI()

BOOL    bMaintenanceMode, bUpdateMode;

string    szIgnore, szTitle;

begin

        

        // Enable dialog caching

        Enable( DIALOGCACHE );

        

        // Determine what events to show.

        bUpdateMode    = FALSE;

        bMaintenanceMode = FALSE;

    

        // Remove this to disabled update mode.

        if( UPDATEMODE ) then

            bUpdateMode = TRUE;

        endif;



        // Remove this to disable maintenance mode.

        if ( MAINTENANCE ) then

            bMaintenanceMode = TRUE;          

        endif;



        // Show appropriate UI



        // TODO: Enable if you want to enable background etc.

        //if ( LoadStringFromStringTable( "TITLE_MAIN", szTitle ) < ISERR_SUCCESS ) then // Load the title string.

        //    szTitle = IFX_SETUP_TITLE;

        //endif;

        //SetTitle( szTitle, 24, WHITE );

        //Enable( FULLWINDOWMODE );                           

        //Enable( BACKGROUND );

        //SetColor( BACKGROUND, RGB( 0, 128, 128 ) );

        

    

        /*if( bUpdateMode ) then

            OnUpdateUIBefore();

        else

            if ( bMaintenanceMode ) then

                OnMaintUIBefore();

            else

                OnFirstUIBefore();

            endif;

        endif; */     

       // OnFirstUIBefore(); 

       

        if( REMOVEONLY )   then   

            //    MessageBox ("卸载", SEVERE);

                OnMaintUIBefore(); 

        else               

            if( bUpdateMode ) then   

             //    MessageBox ("更新", SEVERE);

                OnUpdateUIBefore();

             else  

                 if ( bMaintenanceMode ) then  

                     

                    if( MessageBox( "您已安装最新版本,是否覆盖安装?" , MB_YESNO ) != IDYES ) then

                        abort;

                    endif;                        

                    OnFirstUIBefore();     

                    FeatureReinstall(); 

                else

                //    MessageBox ("第一次安装", SEVERE);                   

                    OnFirstUIBefore(); 

                endif;

             endif; 

        endif;



        // Move Data

        OnMoveData(); 

        

        //OnFirstUIAfter();  

        if( REMOVEONLY )   then

                OnMaintUIAfter();

        else            

                OnFirstUIAfter();            

        endif;



        

    /*    

        if( bUpdateMode ) then

            OnUpdateUIAfter();

        else

            if ( bMaintenanceMode ) then

                OnMaintUIAfter();

            else

                OnFirstUIAfter();

            endif;

        endif;  

      */

        // Disable dialog caching

        Disable(DIALOGCACHE);



end;

你可能感兴趣的:(Install)