// 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;
Installshield的一个例子
最新推荐文章于 2014-09-06 01:35:00 发布