今天写了个程序,要用到一些其它的安装包,还要把一些dll拷贝到system32下.
1.OnMoved事件函数表示安装数据拷贝完后激发此事件,我用来拷贝dll到system32下
2.TARGETDIR是安装数据拷到的目的地,WINDIR是系统路径,如c:\windows
3.拷贝文件用CopyFile函数
4.调用其它安装包用LaunchAppAndWait函数.返回值小于0表示调用失败
Setup.url代码如下:
//
===========================================================================
//
//
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.
//
//
===========================================================================
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
//
Included header files ----------------------------------------------------
#include
"
ifx.h
"
prototype copyFileHandle();
prototype installOtherHandle();
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
//
---------------------------------------------------------------------------
//
OnFirstUIBefore
//
//
First Install UI Sequence - Before Move Data
//
//
The OnFirstUIBefore event is called by OnShowUI when the setup is
//
running in first install mode. By default this event displays UI allowing
//
the end user to specify installation parameters.
//
//
Note: This event will not be called automatically in a
//
program
endprogram style setup.
//
---------------------------------------------------------------------------
function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType;
string
szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
string
szName, szCompany, szTargetPath, szDir, szFeatures;
BOOL bLicenseAccepted;
begin
nSetupType
=
COMPLETE;
szDir
=
TARGETDIR;
szName
=
""
;
szCompany
=
""
;
bLicenseAccepted
=
FALSE;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
//
Beginning of UI Sequence
Dlg_Start:
nResult
=
0
;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SdWelcome:
szTitle
=
""
;
szMsg
=
""
;
//
{{IS_SCRIPT_TAG(Dlg_SdWelcome)
nResult
=
SdWelcome( szTitle, szMsg );
//
}}IS_SCRIPT_TAG(Dlg_SdWelcome)
if
(nResult
=
BACK)
goto
Dlg_Start;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SdLicense2:
szTitle
=
""
;
szOpt1
=
""
;
szOpt2
=
""
;
//
{{IS_SCRIPT_TAG(License_File_Path)
szLicenseFile
=
SUPPORTDIR
^
"
License.rtf
"
;
//
}}IS_SCRIPT_TAG(License_File_Path)
//
{{IS_SCRIPT_TAG(Dlg_SdLicense2)
//
nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
//
}}IS_SCRIPT_TAG(Dlg_SdLicense2)
if
(nResult
=
BACK) then
goto
Dlg_SdWelcome;
else
bLicenseAccepted
=
TRUE;
endif;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SdRegisterUser:
szMsg
=
""
;
szTitle
=
""
;
//
{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)
//
nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
//
}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
if
(nResult
=
BACK)
goto
Dlg_SdLicense2;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SetupType2:
szTitle
=
""
;
szMsg
=
""
;
nResult
=
CUSTOM;
//
{{IS_SCRIPT_TAG(Dlg_SetupType2)
nResult
=
SetupType2( szTitle, szMsg,
""
, nSetupType,
0
);
//
}}IS_SCRIPT_TAG(Dlg_SetupType2)
if
(nResult
=
BACK) then
goto
Dlg_SdRegisterUser;
else
nSetupType
=
nResult;
if
(nSetupType
!=
CUSTOM) then
szTargetPath
=
TARGETDIR;
nSize
=
0
;
FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );
if
(nSize
!=
0
) then
MessageBox( szSdStr_NotEnoughSpace, WARNING );
goto
Dlg_SetupType2;
endif;
endif;
endif;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SdAskDestPath2:
if
((nResult
=
BACK)
&&
(nSetupType
!=
CUSTOM))
goto
Dlg_SetupType2;
szTitle
=
""
;
szMsg
=
""
;
if
(nSetupType
=
CUSTOM) then
//
{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
nResult
=
SdAskDestPath2( szTitle, szMsg, szDir );
//
}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
TARGETDIR
=
szDir;
endif;
if
(nResult
=
BACK)
goto
Dlg_SetupType2;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SdFeatureTree:
if
((nResult
=
BACK)
&&
(nSetupType
!=
CUSTOM))
goto
Dlg_SdAskDestPath2;
szTitle
=
""
;
szMsg
=
""
;
szFeatures
=
""
;
nLevel
=
2
;
if
(nSetupType
=
CUSTOM) then
//
{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)
nResult
=
SdFeatureTree( szTitle, szMsg, TARGETDIR, szFeatures, nLevel );
//
}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
if
(nResult
=
BACK)
goto
Dlg_SdAskDestPath2;
endif;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_SQLServer:
nResult
=
OnSQLServerInitialize( nResult );
if
( nResult
=
BACK )
goto
Dlg_SdFeatureTree;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dlg_ObjDialogs:
nResult
=
ShowObjWizardPages( nResult );
if
(nResult
=
BACK)
goto
Dlg_SQLServer;
Dlg_SdStartCopy2:
szTitle
=
""
;
szMsg
=
""
;
//
{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)
nResult
=
SdStartCopy2( szTitle, szMsg );
//
}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
if
(nResult
=
BACK)
goto
Dlg_ObjDialogs;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
//
Added in 11.0 - Set appropriate StatusEx static text.
SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );
return
0
;
end;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
//
数据安装后
function OnMoved()
begin
//
拷贝到system32
copyFileHandle();
//
安装其它
installOtherHandle();
end;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**/
/*------拷贝文件到system32下-----------*/
function copyFileHandle()
begin
CopyFile(TARGETDIR
^
"
ffmpeg.exe
"
,WINDIR
^
"
system32\\ffmpeg.exe
"
);
CopyFile(TARGETDIR
^
"
ffplay.exe
"
,WINDIR
^
"
system32\\ffplay.exe
"
);
CopyFile(TARGETDIR
^
"
pthreadGC2.dll
"
,WINDIR
^
"
system32\\pthreadGC2.dll
"
);
CopyFile(TARGETDIR
^
"
VSFilter.dll
"
,WINDIR
^
"
system32\\VSFilter.dll
"
);
end;
![None.gif](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**/
/*------------安装其它文件----------------------*/
function installOtherHandle()
begin
if
(LaunchAppAndWait(TARGETDIR
^
"
AviSynth_254.exe
"
,
""
,WAIT)
<
0
) then
MessageBox (
"
Unable to launch
"
+
TARGETDIR
^
"
AviSynth_254.exe
"
+
"
.
"
, SEVERE);
endif;
if
(LaunchAppAndWait(TARGETDIR
^
"
BaoFeng2007V7.02.01skycn.exe
"
,
""
,WAIT)
<
0
) then
MessageBox (
"
Unable to launch
"
+
TARGETDIR
^
"
BaoFeng2007V7.02.01skycn.exe
"
+
"
.
"
, SEVERE);
endif;
end;