Installshield的一个例子

//   Global   variable   declarations. 

STRING     svLogFile,   svDir,   szData; 

NUMBER     nResult;   
string   svValue;   
string   szTitle,szMsg,szQuestion,szBmpPath1,szLicenseFile; 
string   szKey,szName; 
NUMBER   nvType,nvSize; 
STRING       szMsg1,   szMsg2,   szOpt1,   szOpt2; 

      BOOL           bvOpt1,   bvOpt2; 

//   Function   declarations. 

prototype   HandleComponentError(NUMBER); 


#include   "ifx.h " 

program 

        //   Set   the   default   target   location. 
        RegDBSetDefaultRoot   (   HKEY_LOCAL_MACHINE   ); 
        szKey= "SOFTWARE//Microsoft//Windows//CurrentVersion//App   Paths// "+@PRODUCT_KEY;   
        szName= "Path ";               
        RegDBGetKeyValueEx   (   szKey   ,   szName   ,   nvType   ,   svValue   ,   nvSize   );   
        if   (svValue= " ")   then 
            MessageBox   ( "此程序是“ "+@PRODUCT_NAME+ "”的升级程序,必须先安装“ "+@PRODUCT_NAME+ "才能使用该升级程序 ",   SEVERE); 
            abort; 
      else 
            TARGETDIR=svValue; 
      endif;       
          
      
          szBmpPath1=SUPPORTDIR^ " ";   
        DialogSetInfo   (DLG_INFO_ALTIMAGE,   szBmpPath1,   TRUE); 
        Delay(1); 
        SetTitle(@PRODUCT_NAME+ "升级程序安装向导 ",0,BACKGROUNDCAPTION);   
        
      
        
Dlg_Start: 
        //   beginning   of   dialogs   label 

Dlg_SdWelcome: 
        szTitle   =   "欢迎使用“ "+@PRODUCT_NAME+ "”升级程序安装向导 "; 
        szMsg       =   "安装向导将对您计算机中的“ "+@PRODUCT_NAME+ "”进行升级。若要继续,请单击“下一步”。 "; 
        nResult   =   SdWelcome(   szTitle,   szMsg   ); 
        if   (nResult   =   BACK)   goto   Dlg_Start;   
        DialogSetInfo(DLG_INFO_ALTIMAGE,SUPPORTDIR^ "It.BMP ",TRUE); 

Dlg_SdLicense: 
        szLicenseFile   =   SUPPORTDIR   ^   "license.txt "; 
        szTitle         =   " "; 
        szMsg             =   " "; 
        szQuestion   =   "您是否接受上述“许可证协议”的所有条款?如果选择“否”,安装程序将关闭。若要升级“ "+@PRODUCT_NAME+ "”,您必须接受此协议。 "; 
        nResult         =   SdLicense(   szTitle,   szMsg,   szQuestion,   szLicenseFile   ); 
        if   (nResult   =   BACK)   goto   Dlg_SdWelcome; 

Dlg_ObjDialogs: 
        nResult   =   ShowObjWizardPages(nResult); 
        if   (nResult   =   BACK)   goto   Dlg_SdLicense; 
    

        svDir   =   TARGETDIR; 

      

        ComponentSetTarget   (MEDIA,   " <szVarDir> ",   svDir); 

    

        Enable   (STATUSDLG); 

        Enable   (INDVFILESTATUS); 

        StatusUpdate   (ON,   99); 


        //   Transfer   files   to   the   target   system.   

        nResult=ComponentTransferData(MEDIA); 


        //   Handle   any   errors. 

        HandleComponentError   (nResult); 


        //   Disable   the   progress   indicator   and   its   settings. 

        Disable     (INDVFILESTATUS); 

        Disable   (STATUSDLG); 
        szTitle   =@PRODUCT_NAME+ "升级完成 "; 
        szMsg1= " "; 
        szMsg2= "   "; 
        szOpt1= " "; 
        szOpt2= " "; 
        SdFinish   (   szTitle   ,szMsg1,   szMsg2   ,szOpt1,szOpt2,   bvOpt1   ,   bvOpt2   ); 


endprogram 


/*--------------------------------------------------------------------------*/ 

  * 

  *   Function:     HandleComponentError 

  * 

  *     Purpose:     This   function   evaluates   the   value   returned   by   a   Component... 

  *                         function   and   if   the   value   is   less   than   zero,   displays   the   error 

  *                         number   and   aborts   the   setup. 

  * 

/*--------------------------------------------------------------------------*/ 

function   HandleComponentError   (nResult) 


      NUMBER     nvError; 

      STRING     svMedia,   svComponent,   svFileGroup,   svFile; 


begin 

      if   (nResult   <   0)   then 

            ComponentError   (svMedia,   svComponent,   svFileGroup,   svFile,   nvError); 

            SprintfBox   (INFORMATION,   "Data   Transfer   Error   Information ", 

                                    "ComponentError   returned   the   "   + 
                                    "following   data   transfer   error./n "   + 

                                    "Setup   will   now   abort./n/n "   + 

                                    "Media   Name:   %s/nComponent:   %s/nFile   Group:   %s/n "   + 

                                    "File:   %s/nError   Number:   %ld ", 

                                    svMedia,   svComponent,   svFileGroup,   svFile,   nvError); 

            abort; 

      endif; 

end; 

  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值