InstallShield 12 的够用技巧

今天写了个程序,要用到一些其它的安装包,还要把一些dll拷贝到system32下.
1.OnMoved事件函数表示安装数据拷贝完后激发此事件,我用来拷贝dll到system32下
2.TARGETDIR是安装数据拷到的目的地,WINDIR是系统路径,如c:\windows
3.拷贝文件用CopyFile函数
4.调用其它安装包用LaunchAppAndWait函数.返回值小于0表示调用失败

Setup.url代码如下:
None.gif // ===========================================================================
None.gif
//
None.gif
//   File Name:    Setup.rul
None.gif
//
None.gif
//   Description:  Blank setup main script file
None.gif
//
None.gif
//   Comments:     Blank setup is an empty setup project. If you want to
None.gif
//                   create a new project via. step-by step instructions use the
None.gif
//                   Project Assistant.
None.gif
//
None.gif
// ===========================================================================
None.gif
None.gif
//  Included header files ----------------------------------------------------
None.gif
#include  " ifx.h "
None.gifprototype copyFileHandle();   
None.gifprototype installOtherHandle();
None.gif
None.gif
// ---------------------------------------------------------------------------                                                                        
None.gif
//  OnFirstUIBefore
None.gif
//
None.gif
//  First Install UI Sequence - Before Move Data
None.gif
//
None.gif
//  The OnFirstUIBefore event is called by OnShowUI when the setup is
None.gif
//  running in first install mode. By default this event displays UI allowing
None.gif
//  the end user to specify installation parameters.
None.gif
//
None.gif
//  Note: This event will not be called automatically in a
None.gif
//  programdot.gifendprogram style setup.
None.gif
// ---------------------------------------------------------------------------
None.gif
function OnFirstUIBefore()
None.gif    number  nResult, nLevel, nSize, nSetupType;
None.gif    
string   szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
None.gif    
string   szName, szCompany, szTargetPath, szDir, szFeatures;
None.gif    BOOL    bLicenseAccepted;    
None.gifbegin    
None.gif   
None.gif    nSetupType 
=  COMPLETE;    
None.gif    szDir 
=  TARGETDIR;
None.gif    szName 
=   "" ;
None.gif    szCompany 
=   "" ;
None.gif    bLicenseAccepted 
=  FALSE;
None.gif
None.gif
//  Beginning of UI Sequence
None.gif
Dlg_Start:
None.gif    nResult 
=   0 ;
None.gif
None.gifDlg_SdWelcome:
None.gif    szTitle 
=   "" ;
None.gif    szMsg 
=   "" ;
None.gif    
// {{IS_SCRIPT_TAG(Dlg_SdWelcome)
None.gif
    nResult  =  SdWelcome( szTitle, szMsg );
None.gif    
// }}IS_SCRIPT_TAG(Dlg_SdWelcome)
None.gif
     if  (nResult  =  BACK)  goto  Dlg_Start;
None.gif
None.gifDlg_SdLicense2:
None.gif    szTitle 
=   "" ;
None.gif    szOpt1 
=   "" ;
None.gif    szOpt2 
=   "" ;
None.gif    
// {{IS_SCRIPT_TAG(License_File_Path)
None.gif
    szLicenseFile  =  SUPPORTDIR  ^   " License.rtf " ;
None.gif    
// }}IS_SCRIPT_TAG(License_File_Path)
None.gif    
// {{IS_SCRIPT_TAG(Dlg_SdLicense2)
None.gif   
//  nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
None.gif    
// }}IS_SCRIPT_TAG(Dlg_SdLicense2)
None.gif
     if  (nResult  =  BACK) then
None.gif        
goto  Dlg_SdWelcome;
None.gif    
else
None.gif        bLicenseAccepted 
=  TRUE;
None.gif    endif;
None.gif
None.gifDlg_SdRegisterUser:
None.gif    szMsg 
=   "" ;
None.gif    szTitle 
=   "" ;
None.gif    
// {{IS_SCRIPT_TAG(Dlg_SdRegisterUser)    
None.gif   
//  nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
None.gif    
// }}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
None.gif
     if  (nResult  =  BACK)  goto  Dlg_SdLicense2;
None.gif
None.gifDlg_SetupType2:   
None.gif    szTitle 
=   "" ;
None.gif    szMsg 
=   "" ;
None.gif    nResult 
=  CUSTOM;
None.gif    
// {{IS_SCRIPT_TAG(Dlg_SetupType2)    
None.gif
    nResult  =  SetupType2( szTitle, szMsg,  "" , nSetupType,  0  );
None.gif    
// }}IS_SCRIPT_TAG(Dlg_SetupType2)
None.gif
     if  (nResult  =  BACK) then
None.gif        
goto  Dlg_SdRegisterUser;
None.gif    
else
None.gif        nSetupType 
=  nResult;
None.gif        
if  (nSetupType  !=  CUSTOM) then
None.gif            szTargetPath 
=  TARGETDIR;
None.gif            nSize 
=   0 ;
None.gif            FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );
None.gif            
if  (nSize  !=   0 ) then      
None.gif                MessageBox( szSdStr_NotEnoughSpace, WARNING );
None.gif                
goto  Dlg_SetupType2;
None.gif            endif;
None.gif        endif;   
None.gif    endif;
None.gif
None.gifDlg_SdAskDestPath2:
None.gif    
if  ((nResult  =  BACK)  &&  (nSetupType  !=  CUSTOM))  goto  Dlg_SetupType2;
None.gif    szTitle 
=   "" ;
None.gif    szMsg 
=   "" ;
None.gif    
if  (nSetupType  =  CUSTOM) then
None.gif                
// {{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)    
None.gif
        nResult  =  SdAskDestPath2( szTitle, szMsg, szDir );
None.gif                
// }}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
None.gif
        TARGETDIR  =  szDir;
None.gif    endif;
None.gif    
if  (nResult  =  BACK)  goto  Dlg_SetupType2;
None.gif
None.gifDlg_SdFeatureTree: 
None.gif    
if  ((nResult  =  BACK)  &&  (nSetupType  !=  CUSTOM))  goto  Dlg_SdAskDestPath2;
None.gif    szTitle 
=   "" ;
None.gif    szMsg 
=   "" ;
None.gif    szFeatures 
=   "" ;
None.gif    nLevel 
=   2 ;
None.gif    
if  (nSetupType  =  CUSTOM) then
None.gif        
// {{IS_SCRIPT_TAG(Dlg_SdFeatureTree)    
None.gif
        nResult  =  SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
None.gif        
// }}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
None.gif
         if  (nResult  =  BACK)  goto  Dlg_SdAskDestPath2;  
None.gif    endif;
None.gif
None.gifDlg_SQLServer:
None.gif    nResult 
=  OnSQLServerInitialize( nResult );
None.gif    
if ( nResult  =  BACK )  goto  Dlg_SdFeatureTree;
None.gif
None.gifDlg_ObjDialogs:
None.gif    nResult 
=  ShowObjWizardPages( nResult );
None.gif    
if  (nResult  =  BACK)  goto  Dlg_SQLServer;
None.gif    
None.gifDlg_SdStartCopy2:
None.gif    szTitle 
=   "" ;
None.gif    szMsg 
=   "" ;
None.gif    
// {{IS_SCRIPT_TAG(Dlg_SdStartCopy2)    
None.gif
    nResult  =  SdStartCopy2( szTitle, szMsg );    
None.gif    
// }}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
None.gif
     if  (nResult  =  BACK)  goto  Dlg_ObjDialogs;
None.gif
None.gif    
//  Added in 11.0 - Set appropriate StatusEx static text.
None.gif
    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
None.gif    
return   0 ;  
None.gifend; 
None.gif
None.gif
None.gif
// 数据安装后 
None.gif
function OnMoved()
None.gifbegin 
None.gif  
// 拷贝到system32
None.gif
  copyFileHandle();
None.gif  
// 安装其它   
None.gif
  installOtherHandle();
None.gifend; 
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/**/ /*------拷贝文件到system32下-----------*/
None.giffunction copyFileHandle()
None.gifbegin      
None.gif  CopyFile(TARGETDIR
^ " ffmpeg.exe " ,WINDIR ^ " system32\\ffmpeg.exe " ); 
None.gif  CopyFile(TARGETDIR
^ " ffplay.exe " ,WINDIR ^ " system32\\ffplay.exe " ); 
None.gif  CopyFile(TARGETDIR
^ " pthreadGC2.dll " ,WINDIR ^ " system32\\pthreadGC2.dll " );
None.gif  CopyFile(TARGETDIR
^ " VSFilter.dll " ,WINDIR ^ " system32\\VSFilter.dll " );
None.gifend; 
None.gif
ExpandedBlockStart.gifContractedBlock.gif
/**/ /*------------安装其它文件----------------------*/    
None.giffunction installOtherHandle()
None.gifbegin   
None.gif    
if  (LaunchAppAndWait(TARGETDIR ^ " AviSynth_254.exe " "" ,WAIT)  <   0 ) then
None.gif      MessageBox (
" Unable to launch  " + TARGETDIR ^ " AviSynth_254.exe "   +   " . " , SEVERE);
None.gif    endif;   
None.gif    
if  (LaunchAppAndWait(TARGETDIR ^ " BaoFeng2007V7.02.01skycn.exe " "" ,WAIT)  <   0 ) then
None.gif      MessageBox (
" Unable to launch  " + TARGETDIR ^ " BaoFeng2007V7.02.01skycn.exe "   +   " . " , SEVERE);
None.gif    endif;       
None.gifend;

转载于:https://www.cnblogs.com/fishert/archive/2007/06/26/796627.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值