InstallShield Setup.rul 简单示例

//===========================================================================
//
//  File Name:    Setup.rul
//
//  Description:  Blank setup main script file
//
//  Comments:     Blank setup is an empty setup project. If you want to
//  create a new project via. step-by step instructions use the
//  Project Assistant.
//
//===========================================================================


// Included header files ----------------------------------------------------
#include "ifx.h"


// Note: In order to have your InstallScript function executed as a custom
// action by the Windows Installer, it must be prototyped as an 
// entry-point function.


// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
    
/* export prototype MyFunction(HWND); */


//---------------------------------------------------------------------------
// OnFirstUIBefore
//
// The OnFirstUIBefore event is called by the framework when the setup is
// running in first install mode. By default this event displays UI allowing
// the end user to specify installation parameters.
//---------------------------------------------------------------------------
function OnFirstUIBefore()
    NUMBER nResult, nSetupType, nvSize, nUser;
    STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile, svFontTitle;
    STRING szLicenseFile;
BOOL bCustom, bIgnore1, bIgnore2;
begin
    // TO DO: if you want to enable background, window title, and caption bar title                                                                   
    // SetTitle( @PRODUCT_NAME, 24, WHITE );                                        
    //SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );                  
    SetTitle( "EIM0.3-安装向导", 0,  BACKGROUNDCAPTION ); 
    szTitle = FOLDER_FONTS ^ "Estre.ttf"; 
    svFontTitle = "Estrangelo Edessa";
    RegisterFontResource ( szTitle, svFontTitle, TRUE, REGFONT_OPTION_DEFAULT ); 
    // Enable( FULLWINDOWMODE );   
    // Enable( BACKGROUND );  
    //SetColor(BACKGROUND,RGB (0, 128, 128));   
    // DialogSetInfo(DLG_INFO_ALTIMAGE,SUPPORTDIR^"logo.BMP",TRUE); 
    // Added in InstallShield 15 - Show an appropriate error message if
    // -removeonly is specified and the product is not installed.
    if( REMOVEONLY ) then
        Disable( DIALOGCACHE );
szMsg = SdLoadString( IDS_IFX_ERROR_PRODUCT_NOT_INSTALLED_UNINST );
    SdSubstituteProductInfo( szMsg );
MessageBox( szMsg, SEVERE );
abort;
    endif;
    
nSetupType = TYPICAL;


Dlg_SdWelcome:
    szTitle = "欢迎使用\"EIM0.3\"安装向导。";
    szMsg   = "这个向导将指引你完成\"EIM0.3\"的安装过程。\n\n\n在开始安装之前,建议先关闭其他所有应用程序。这将允许安装程序更新指定的系统文件,而不需要启动你的计算机。单击[下一步]继续。";
    nResult = SdWelcome(szTitle, szMsg);
    if (nResult = BACK) goto Dlg_SdWelcome;

szTitle   = "";
svName    = "";
    svCompany = "";
Dlg_SdLicense:
szTitle = "许可证协议\n 在安装\"EIM0.3\"之前,请仔细阅读授权协议。";   
szLicenseFile = SUPPORTDIR ^ "License.txt";
if(!MAINTENANCE)then
SdLicense2 (szTitle, "", "", szLicenseFile, FALSE);
endif;
if (nResult = BACK) goto Dlg_SdWelcome;


Dlg_SdAskDestPath: 
szTitle = "选择安装位置";
szMsg   = "请选择软件的安装位置。单击[下一步]继续。" ;
    nResult = SdAskDestPath(szTitle, szMsg, INSTALLDIR, 0);
    if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SdStartCopy:
    szTitle = "";
    szMsg   = "";
    nResult = SdStartCopy2( szTitle, szMsg );

    if (nResult = BACK) then
       goto Dlg_SdAskDestPath;;
    endif;


    // Added in IS 2009 - Set appropriate StatusEx static text.
    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );


    // setup default status
    Enable(STATUSEX);
 
    return 0;
end;
//---------------------------------------------------------------------------
// OnFirstUIAfter
//
// The OnFirstUIAfter event called by the framework after the file transfer
// of the setup when the setup is running in first install mode. By default
// this event displays UI that informs the end user that the setup has been
// completed successfully.
//---------------------------------------------------------------------------
function OnFirstUIAfter()
    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2, szFileName;
    NUMBER bOpt1, bOpt2, nResult;
begin 
SetTitle( "EIM0.3-卸载向导", 0,  BACKGROUNDCAPTION );
    ///
    //安装完成启动程序
Disable(STATUSEX); 
szOpt2  = "运行EIM";
    bOpt2   = TRUE;    
    if ( BATCH_INSTALL ) then
    SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
    else
   SdFinish(szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bOpt1, bOpt2);
   if (bOpt2) then 
          LaunchApp (TARGETDIR ^ "IM2_Probject.exe", ""); 
        endif;
endif;
/
//卸载程序快捷方式
//szFileName = UNINSTALL_STRING +" /UNINSTALL";
    //nResult = StrFind(szFileName,".exe");
    //if nResult >=0 then
    //  StrSub(szMsg1,szFileName,0,nResult + 4);
    //  StrSub(szMsg2,szFileName,nResult + 4,200);
    //  LongPathToQuote(szMsg1, FALSE );
    //  LongPathToQuote(szMsg2, FALSE );
    //  szFileName = "\"" + szMsg1 + "\"" +szMsg2;
    //endif;
    //AddFolderIcon(FOLDER_PROGRAMS^"GridInfo/EIM0.3","Uninstall",szFileName,WINDIR,"",0,"",REPLACE);
end;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值