📄 setup.rul
字号:
////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-2000, InstallShield Software Corporation
// II SS (c) 1990-1996, InstallShield Corporation
// IIIIIII SSSSSS All Rights Reserved.
//
//
// This code is generated as a starting setup template. You should
// modify it to provide all necessary steps for your setup.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This template script performs a basic setup. With minor
// modifications, this template can be adapted to create
// new, customized setups.
//
////////////////////////////////////////////////////////////////////////////////
// Include header files
#include "ifx.h" //DO NOT REMOVE
////////////////////// string defines ////////////////////////////
//////////////////// installation declarations ///////////////////
// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
prototype CleanUpInstall();
prototype DialogShowSdFinishReboot();
prototype SetupRegistry();
prototype SetupFolders();
prototype DeleteFolders();
prototype DeleteRegistry();
prototype SetupInstall();
prototype CheckRequirements();
// your script function prototypes
prototype GetSysINF(LIST);
// your global variables
BOOL bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
STRING svName,svCompany, svSerial;
STRING svDir;
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnFirstUIBefore
//
// EVENT: FirstUIBefore event is sent when installation is run for the first
// time on given machine. In the handler installation usually displays
// UI allowing end user to specify installation parameters. After this
// function returns, ComponentTransferData is called to perform file
// transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()
NUMBER nResult,nSetupType;
STRING szTitle, szMsg;
STRING szLicenseFile, szQuestion;
STRING szDir,svPicName;
STRING szfolder;
STRING szComponents, szTargetdir;
NUMBER nLevel,nCount;
LIST listStartCopy;
begin
// TO DO: if you want to enable background, window title, and caption bar title
//界面设计及主题标识
SetTitle( @TITLE_MAIN, 24, WHITE );
SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION );
Enable( FULLWINDOWMODE );
Enable( BACKGROUND );
// SetColor(BACKGROUND,RGB (0, 128, 128));
nSetupType = TYPICAL;//预设安装类型
//安装默认安装路径
TARGETDIR = "D:\\"^@PRODUCT_NAME;
szDir = TARGETDIR;
SHELL_OBJECT_FOLDER = @FOLDER_NAME;
svName = "Name";
svCompany = "Company";
svSerial = "";
CheckRequirements();
SetupInstall();
Dlg_Start:
// beginning of dialogs label
//欢迎对话框
Dlg_SdWelcome:
//对话框的信息列表处装载位图
svPicName = SUPPORTDIR ^ "pic6.bmp";
DialogSetInfo (DLG_INFO_ALTIMAGE, svPicName, TRUE);
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;
nCount = 0;
//软件协议对话框
Dlg_SdLicense:
/* PlaceBitmap ("",11,0,0,REMOVE);
svPicName = SUPPORTDIR ^ "pic2.bmp";
PlaceBitmap (svPicName,13,0,0,FULLSCREENSIZE); */
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle = "";
szMsg = "";
szQuestion = "";
nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
if (nResult = BACK) goto Dlg_SdWelcome;
//信息对话框
/*Dlg_SdShowInfoList:
PlaceBitmap ("",13,0,0,REMOVE);
svPicName = SUPPORTDIR ^ "pic3.bmp";
PlaceBitmap (svPicName,14,0,0,FULLSCREENSIZE);
// Delay(1);
File = SUPPORTDIR ^ "infolist.txt";
list = ListCreate( STRINGLIST );
ListReadFromFile( list, szFile );
szTitle = "";
szMsg = "";
// nResult = SdShowInfoList( szTitle, szMsg, list );
ListDestroy( list );
if (nResult = BACK) goto Dlg_SdLicense;
//用户信息注册对话框
Dlg_SdRegisterUserEx:
szMsg = "";
szTitle = "";
nResult = SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial );
if (nResult = BACK) goto Dlg_SdShowInfoList;
if (svSerial!= Serial)then
if nCount=2 then
svTmp = "对不起,您三次输入的序列号都不正确,无法使用该应用软件!";
SetDialogTitle(DLG_MSG_SEVERE,"序列号输入错误");
MessageBox(svTmp,SEVERE);
abort;
else
Sprintf(svTmp,"输入序列号不正确,请重试,您还有%d次机会!",(2-nCount));
SetDialogTitle(DLG_MSG_SEVERE,"序列号输入错误");
MessageBox(svTmp,SEVERE);
nCount = nCount+1;
goto Dlg_SdRegisterUserEx;
endif;
endif;
if (nResult = BACK) goto Dlg_SdLicense; */
//设置安装路径对话框
Dlg_SdAskDestPath:
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
TARGETDIR = szDir;
if (nResult = BACK) goto Dlg_SdLicense;
/* //选择安装类型对话框
Dlg_SetupType:
/*PlaceBitmap ("",14,0,0,REMOVE);
svPicName = SUPPORTDIR ^ "pic3.bmp";
PlaceBitmap (svPicName,15,0,0,FULLSCREENSIZE);
szTitle = "";
szMsg = "";
nResult = SetupType ( szTitle , szMsg , "" , nSetupType , 0 );
if (nResult = BACK) then
goto Dlg_SdAskDestPath;
else
nSetupType = nResult;
if (nSetupType != CUSTOM) then
szTargetPath = TARGETDIR;
nvSize = 0;
ComponentCompareSizeRequired(MEDIA,szTargetPath,nvSize);
if (nvSize != 0) then
MessageBox( szSdStr_NotEnoughSpace, WARNING );
goto Dlg_SetupType;
endif;
endif;
endif;
//组件树形视图对话框
Dlg_SdComponentTree:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType;
szTitle = "";
szMsg = "";
szTargetdir = TARGETDIR;
szComponents = "";
nLevel = 2;
if (nSetupType = CUSTOM) then
nResult = SdComponentTree(szTitle, szMsg, szTargetdir, szComponents, nLevel);
if (nResult = BACK) goto Dlg_SetupType;
endif; */
Dlg_ObjDialogs:
nResult = ShowObjWizardPages(nResult);
if (nResult = BACK) goto Dlg_SdAskDestPath;
//选择安装文件夹对话框
Dlg_SdSelectFolder:
szfolder = SHELL_OBJECT_FOLDER;
szTitle = "";
szMsg = "";
nResult = SdSelectFolder( szTitle, szMsg, szfolder );
SHELL_OBJECT_FOLDER = szfolder;
if (nResult = BACK) goto Dlg_ObjDialogs;
//开始复制文件对话框
Dlg_SdStartCopy:
szTitle = "";
szMsg = "";
listStartCopy = ListCreate( STRINGLIST );
GetSysINF(listStartCopy);
ListAddString (listStartCopy, "[用户信息]: ", AFTER);
ListAddString (listStartCopy, " 用户名称:" + svName, AFTER);
ListAddString (listStartCopy, " 公司名称:" + svCompany, AFTER);
ListAddString (listStartCopy, " 序列号 :" + svSerial, AFTER);
ListAddString (listStartCopy, "[应用程序信息]: ", AFTER);
ListAddString (listStartCopy, " 操作系统目录 :" + WINDIR, AFTER);
ListAddString (listStartCopy, " 应用程序安装目录:" + TARGETDIR, AFTER);
//The following is an example of how to add a string(svName) to a list(listStartCopy).
nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);
if (nResult = BACK) goto Dlg_SdSelectFolder;
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
return 0;
end;
/////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnFirstUIAfter
//
// EVENT: FirstUIAfter event is sent after file transfer, when installation
// is run for the first time on given machine. In this event handler
// installation usually displays UI that will inform end user that
// installation has been completed successfully.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
begin
SetupFolders();
SetupRegistry();
Disable(STATUSEX);
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
Delay(1);
szMsg2 = "";
szOption1 = "";
szOption2 = "";
szTitle = "";
CleanUpInstall();
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMaintUIBefore
//
// EVENT: MaintUIBefore event is sent when end user runs installation that
// has already been installed on the machine. Usually this happens
// through Add/Remove Programs applet. In the handler installation
// usually displays UI allowing end user to modify existing installation
// or uninstall application. After this function returns,
// ComponentTransferData is called to perform file transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIBefore()
STRING svResult,szCaption;
NUMBER nResult;
begin
//To Do: if you want to enable background, window title, and caption bar title
//Maintenance Mode
svResult = SdLoadString(IFX_MAINTUI_MSG);
szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
if (nResult = IDCANCEL) then
exit;
elseif(nResult = IDOK) then
// setup default status
SetStatusWindow(0, "");
Enable(STATUSEX);
StatusUpdate(ON, 100);
//-->Remove all components
ComponentRemoveAll();
endif;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMaintUIAfter
//
// EVENT: MaintUIAfter event is sent after file transfer, when end user runs
// installation that has already been installed on the machine. Usually
// this happens through Add/Remove Programs applet.
// In the handler installation usually displays UI that will inform
// end user that maintenance/uninstallation has been completed successfully.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIAfter()
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
begin
DeleteFolders();
DeleteRegistry();
//DeleteFile ( TARGETDIR^"DOT.LDB" );
DeleteDir ( TARGETDIR , ALLCONTENTS );
Disable(STATUSEX);
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = "卸载化工间歇聚合反应过程的辨识与控制(BatchAPC v1.0)已完成";
szMsg2 = "单击[完成]结束卸载" ;
szOption1 = "";
szOption2 = "";
szTitle = "卸载完成";
SdFinishEx(szTitle,szMsg1,szMsg2,szOption1,szOption2,bOpt1,bOpt2);
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: OnMoving
//
// EVENT: Moving event is sent when file transfer is started as a result of
// ComponentTransferData call, before any file transfer operations
// are performed.
//
///////////////////////////////////////////////////////////////////////////////
function OnMoving()
STRING szAppPath;
begin
// Set LOGO Compliance Application Path
// TO DO : if your application .exe is in a subfolder of TARGETDIR then add subfolder
szAppPath = TARGETDIR;
RegDBSetItem(REGDB_APPPATH, szAppPath);
RegDBSetItem(REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY);
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CleanUpInstall //
// //
// Purpose: This cleans up the setup. Anything that should //
// be released or deleted at the end of the setup should //
// be done here. //
// //
///////////////////////////////////////////////////////////////////////////////
//判断完成标志函数
function CleanUpInstall()
begin
if (bInstallAborted) then
return 0;
endif;
DialogShowSdFinishReboot();
if (BATCH_INSTALL) then // ensure locked files are properly written
CommitSharedFiles(0);
endif;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupInstall //
// //
// Purpose: This will setup the installation. Any general initialization //
// needed for the installation should be performed here. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupInstall()
begin
Enable( CORECOMPONENTHANDLING );
bInstallAborted = FALSE;
if (bIs32BitSetup) then
svDir = PROGRAMFILES ^ @PRODUCT_NAME;
else
svDir = PROGRAMFILES ^ @PRODUCT_NAME16; //^ @COMPANY_NAME16 use shorten names
endif;
TARGETDIR = svDir;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -