📄 setup.rul
字号:
////////////////////////////////////////////////////////////////////////////////
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This script was generated based on the selections you made in
// the Project Wizard. Refer to the help topic entitled "Modify
// the script that the Project Wizard generates" for information
// on possible next steps.
//
////////////////////////////////////////////////////////////////////////////////
// Include header files
#include "ifx.h"
#define Serial"075527685148"
prototype GetSysINF(LIST);
////////////////////// string defines ////////////////////////////
//////////////////// installation declarations ///////////////////
// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
// your script function prototypes
// your global variables
//////////////////////////////////////////////////////////////////////////////
//
// 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, FeatureTransferData is called to perform file
// transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnFirstUIBefore()
number nResult,nSetupType;
string szTitle, szMsg;
string szLicenseFile, szQuestion;
string szName, szCompany;
STRING svName, svCompany, svSerial;
string szTargetPath;
string szDir;
STRING svTmp;
string szfolder;
string szFeatures, szTargetdir;
number nLevel;
LIST listStartCopy;
number nvSize,nCount;
number nUser;
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 );
// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
// SetColor(BACKGROUND,RGB (0, 128, 128));
SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
nSetupType = TYPICAL;
szDir = INSTALLDIR;
szName = "";
szCompany = "";
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense:
szLicenseFile = SUPPORTDIR ^ "license.txt";
szTitle = "";
szMsg = "";
szQuestion = "";
nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdCustomerInformation:
szMsg = "";
szTitle = "";
nResult = SdCustomerInformation( szTitle, szName, szCompany, nUser );
if (nResult = BACK) goto Dlg_SdLicense;
Dlg_SdRegisterUserEx:
szMsg = "";
szTitle = "";
nResult = SdRegisterUserEx( szTitle, szMsg, svName, svCompany, svSerial );
if (nResult = BACK) goto Dlg_SdCustomerInformation;
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;
Dlg_SdAskDestPath:
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
INSTALLDIR = szDir;
if (nResult = BACK) goto Dlg_SdCustomerInformation;
Dlg_SetupType:
szTitle = "";
szMsg = "";
nResult = SetupType ( szTitle , szMsg , "" , nSetupType , 0 );
if (nResult = BACK) then
goto Dlg_SdAskDestPath;
else
nSetupType = nResult;
if (nSetupType != CUSTOM) then
szTargetPath = INSTALLDIR;
nvSize = 0;
FeatureCompareSizeRequired(MEDIA,szTargetPath,nvSize);
if (nvSize != 0) then
MessageBox( szSdStr_NotEnoughSpace, WARNING );
goto Dlg_SetupType;
endif;
endif;
endif;
Dlg_SdFeatureTree:
if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType;
szTitle = "";
szMsg = "";
szTargetdir = INSTALLDIR;
szFeatures = "";
nLevel = 2;
if (nSetupType = CUSTOM) then
nResult = SdFeatureTree(szTitle, szMsg, szTargetdir, szFeatures, nLevel);
if (nResult = BACK) goto Dlg_SetupType;
endif;
Dlg_SdSelectFolder:
szfolder = SHELL_OBJECT_FOLDER;
szTitle = "";
szMsg = "";
nResult = SdSelectFolder( szTitle, szMsg, szfolder );
SHELL_OBJECT_FOLDER = szfolder;
if (nResult = BACK) goto Dlg_SdFeatureTree;
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, " 操作系统目录 :" + WindowsFolder, AFTER);
ListAddString (listStartCopy, " 应用程序安装目录:" + INSTALLDIR, AFTER);
//The following is an example of how to add a string(szName) to a list(listStartCopy).
//eg. ListAddString(listStartCopy,szName,AFTER);
nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
ListDestroy(listStartCopy);
if (nResult = BACK) goto Dlg_SdSelectFolder;
Enable(STATUSEX);
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,
// FeatureTransferData is called to perform file transfer.
//
///////////////////////////////////////////////////////////////////////////////
function OnMaintUIBefore()
NUMBER nResult, nType;
STRING szTitle, szMsg, svDir, svResult, szCaption;
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 );
// SetColor(BACKGROUND,RGB (0, 128, 128));
// Enable( FULLWINDOWMODE );
// Enable( BACKGROUND );
Dlg_Start:
Disable(BACKBUTTON);
nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);
Enable(BACKBUTTON);
if (nType = REMOVEALL) then
svResult = SdLoadString(IFX_MAINTUI_MSG);
szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
if (nResult = IDCANCEL) goto Dlg_Start;
endif;
nResult = NEXT;
Dlg_SdFeatureTree:
if (nType = MODIFY) then
szTitle = "";
szMsg = "";
nResult = SdFeatureTree(szTitle, szMsg, TARGETDIR, "", 2);
if (nResult = BACK) goto Dlg_Start;
endif;
switch(nType)
case REMOVEALL: ComponentRemoveAll();
case REPAIR: ComponentReinstall();
endswitch;
Enable(STATUSEX);
end;
///////////////////////////////////////////////////////////////////////////////
// function GetSysINF(listInfo)
// 获得系统信息
///////////////////////////////////////////////////////////////////////////////
function GetSysINF(listInfo)
NUMBER nvResult,nCount,nTmp;
STRING svResult,szInfo,svTmp;
LIST listTmp;
begin
szInfo = "[系统信息]";
ListAddString(listInfo, szInfo, AFTER);
// 获得扩展内存信息.
if (GetSystemInfo (EXTENDEDMEMORY, nvResult, svResult) < 0) then
szInfo = "获得扩展内存信息.";
else
nTmp = GetMemFree()/1024;
Sprintf(szInfo, " 扩展内存: %d K", nvResult);
endif;
ListAddString(listInfo, szInfo, AFTER);
// 获得根驱动器信息.
if (GetSystemInfo (BOOTUPDRIVE, nvResult, svResult) < 0) then
szInfo = "不能获得根驱动器信息.";
else
Sprintf(szInfo, " 根驱动器: %s", svResult);
nvResult = GetDiskSpaceEx(svResult,MBYTES);
Sprintf(svTmp, "(自由空间为:%dMB)", nvResult);
szInfo = szInfo +svTmp;
endif;
ListAddString(listInfo, szInfo, AFTER);
// 获得CD-ROM信息.
if (GetSystemInfo (CDROM, nvResult, svResult) < 0) then
szInfo = "不能获得CD-ROM信息.";
else
if (nvResult = 0) then
svResult = "没有";
else
listTmp = ListCreate (STRINGLIST);
if (GetValidDrivesList (listTmp, CDROM_DRIVE, -1) < 0) then
MessageBox("",SEVERE);
else
svTmp = "";
svResult = "(";
nTmp = ListGetFirstString (listTmp, svTmp);
while (nTmp != END_OF_LIST)
nTmp = ListGetNextString (listTmp, svTmp);
if(svResult = "(") then
svResult = svResult + svTmp + ":";
else
svResult = svResult + "," + svTmp + ":";
endif;
endwhile;
svResult = svResult + ")";
endif;
ListDestroy(listTmp);
endif;
Sprintf(szInfo, " CDROM: %s", svResult);
endif;
ListAddString(listInfo, szInfo, AFTER);
// 获得VIDEO信息.
if (GetSystemInfo (VIDEO, nvResult, svResult) < 0) then
szInfo = "不能获得VIDEO信息.";
else
switch (nvResult)
case IS_UNKNOWN:
szInfo = " VIDEO: 未知";
case IS_SVGA:
szInfo = " VIDEO: SVGA";
case IS_XVGA:
szInfo = " VIDEO: XVGA";
case IS_UVGA:
szInfo = " VIDEO: UVGA";
endswitch;
endif;
ListAddString(listInfo, szInfo, AFTER);
// 获得可用颜色数.
if (GetSystemInfo (COLORS, nvResult, svResult) < 0) then
szInfo = "不能获得颜色数信息.";
else
Sprintf(szInfo, " 颜色数: %d", nvResult);
endif;
ListAddString(listInfo, szInfo, AFTER);
// 获得当前日期.
if (GetSystemInfo (DATE, nvResult, svResult) < 0) then
szInfo = "不能获得日期信息.";
else
Sprintf(szInfo, " 当前日期: %s", svResult);
endif;
ListAddString(listInfo, szInfo, AFTER);
// 得到当前时间.
if (GetSystemInfo (TIME, nvResult, svResult) < 0) then
szInfo = "不能获得时间信息.";
else
Sprintf(szInfo, " 目前时间: %s", svResult);
endif;
ListAddString(listInfo, szInfo, AFTER);
// 获得操作系统信息.
if (GetSystemInfo (OS, nvResult, svResult) < 0) then
szInfo = "不能获得操作系统信息.";
else
switch (nvResult)
case IS_WINDOWSNT:
szInfo = " 操作系统: Windows NT";
case IS_WINDOWS9X:
GetSystemInfo (WINMINOR, nvResult, svResult);
if (nvResult < 10) then
szInfo = " 操作系统: Windows 95";
else
szInfo = " 操作系统: Windows 98";
endif;
endswitch;
endif;
ListAddString(listInfo, szInfo, AFTER);
// Display the information.
//szTitle = "System Information";
//szMsg = "The following is some information related to your system:\n";
// SdShowInfoList (szTitle, szMsg, listInfo);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -