📄 setup.rul
字号:
////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-1998, 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 "sdlang.h"
#include "sddialog.h"
////////////////////// string defines ////////////////////////////
#define UNINST_LOGFILE_NAME "Uninst.isu"
//////////////////// installation declarations ///////////////////
// ----- DLL function prototypes -----
// your DLL function prototypes
// ---- script function prototypes -----
// generated by the Project Wizard
prototype ShowDialogs();
prototype MoveFileData();
prototype HandleMoveDataError( NUMBER );
prototype ProcessBeforeDataMove();
prototype ProcessAfterDataMove();
prototype SetupRegistry();
prototype SetupFolders();
prototype CleanUpInstall();
prototype SetupInstall();
prototype SetupScreen();
prototype CheckRequirements();
prototype DialogShowSdWelcome();
prototype DialogShowSdLicense();
prototype DialogShowSdRegisterUserEx();
prototype DialogShowSdAskDestPath();
prototype DialogShowSdFinishReboot();
// your script function prototypes
// ----- global variables ------
// generated by the Project Wizard
BOOL bIsWindowsNT4, bIsWindowsNT351, bIsWindows98, bIsWindows95;
BOOL bIsShellExplorer, bInstallAborted, bIs32BitSetup;
STRING svDir;
STRING svName, svCompany, svSerial;
STRING svDefGroup;
STRING szAppPath;
STRING svSetupType;
LIST listStartCopy;
// your global variables
///////////////////////////////////////////////////////////////////////////////
//
// MAIN PROGRAM
//
// The setup begins here by hiding the visible setup
// window. This is done to allow all the titles, images, etc. to
// be established before showing the main window. The setup is
// then performed in a series of calls to script defined functions,
// with error checking at each step.
//
///////////////////////////////////////////////////////////////////////////////
program
Disable( BACKGROUND );
CheckRequirements();
SetupInstall();
SetupScreen();
if (ShowDialogs()<0) goto end_install;
if (ProcessBeforeDataMove()<0) goto end_install;
if (MoveFileData()<0) goto end_install;
if (ProcessAfterDataMove()<0) goto end_install;
if (SetupRegistry()<0) goto end_install;
if (SetupFolders()<0) goto end_install;
end_install:
CleanUpInstall();
// If an unrecoverable error occurred, clean up
// the partial installation. Otherwise, exit normally.
if (bInstallAborted) then
abort;
endif;
endprogram
///////////////////////////////////////////////////////////////////////////////
//
// Function: ShowDialogs
//
// Purpose: This function manages the display and navigation of
// the standard dialogs that exist in a setup.
//
///////////////////////////////////////////////////////////////////////////////
function ShowDialogs()
NUMBER nResult;
begin
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
nResult = DialogShowSdWelcome();
if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense:
nResult = DialogShowSdLicense();
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdAskDestPath:
nResult = DialogShowSdAskDestPath();
if (nResult = BACK) goto Dlg_SdLicense;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: ProcessBeforeDataMove
//
// Purpose: This function performs any necessary operations prior to the
// actual file transfer.
//
///////////////////////////////////////////////////////////////////////////////
function ProcessBeforeDataMove()
STRING svLogFile;
NUMBER nResult;
begin
// Create app information, uninstallation, and App Paths registry keys.
InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
svLogFile = UNINST_LOGFILE_NAME;
nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
if (nResult < 0) then
MessageBox( @ERROR_UNINSTSETUP, WARNING );
endif;
szAppPath = TARGETDIR; // TO DO : if your application .exe is in a subfolder
// of TARGETDIR then add subfolder
if ((bIs32BitSetup) && (bIsShellExplorer)) then
RegDBSetItem( REGDB_APPPATH, szAppPath );
RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
endif;
// TO DO : any other tasks you want to perform before file transfer
//
// If you are installing self-registering files using the
// batch method, remove the slashes from the line below:
//
// Enable ( SELFREGISTERBATCH );
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: MoveFileData
//
// Purpose: This function handles the file transfer for
// the setup.
//
///////////////////////////////////////////////////////////////////////////////
function MoveFileData()
NUMBER nResult, nDisk;
begin
nDisk = 1;
SetStatusWindow( 0, "" );
Disable( DIALOGCACHE );
Enable( STATUS );
StatusUpdate( ON, 100 );
nResult = ComponentMoveData( MEDIA, nDisk, 0 );
HandleMoveDataError( nResult );
Disable( STATUS );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: HandleMoveDataError
//
// Purpose: This function handles the error (if any) during the file transfer
// operation.
//
///////////////////////////////////////////////////////////////////////////////
function HandleMoveDataError( nResult )
STRING szErrMsg, svComponent , svFileGroup , svFile;
begin
svComponent = "";
svFileGroup = "";
svFile = "";
switch (nResult)
case 0:
return 0;
default:
ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
szErrMsg = @ERROR_MOVEDATA + "\n\n" +
@ERROR_COMPONENT + " " + svComponent + "\n" +
@ERROR_FILEGROUP + " " + svFileGroup + "\n" +
@ERROR_FILE + " " + svFile;
SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
bInstallAborted = TRUE;
return nResult;
endswitch;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: ProcessAfterDataMove
//
// Purpose: This function performs any necessary operations needed after
// all files have been transferred.
//
///////////////////////////////////////////////////////////////////////////////
function ProcessAfterDataMove()
STRING szReferenceFile, szMsg;
begin
// TO DO : update self-registered files and other processes that
// should be performed after the files have been transferred.
//
// If you are installing self-registering files using the
// batch method, remove the slashes from the lines below:
//
// if Do ( SELFREGISTRATIONPROCESS ) < 0 then
// szMsg = "File(s) failed to self-register: \n" + ERRORFILENAME;
// MessageBox (szMsg, WARNING);
// endif;
// DeinstallSetReference specifies a file to be checked before
// uninstallation. If the file is in use, uninstallation will not proceed.
szReferenceFile = svDir ^ @PRODUCT_KEY; // TO DO : If your file is in a
// subfolder of svDir add that here
DeinstallSetReference( szReferenceFile );
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: SetupRegistry
//
// Purpose: This function makes the registry entries for this setup.
//
///////////////////////////////////////////////////////////////////////////////
function SetupRegistry()
#define WM_WININICHANGE 0x001A
#define HWND_BROADCAST 0xffff
NUMBER nResult, nType, nSize;
STRING szKey, szEnv;
POINTER pEnv;
begin
// TO DO : Add all your registry entry keys here.
// Call registry functions and/or create keys from
// the InstallShield IDE's Resources pane.
Disable(LOGGING);
szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
nResult = RegDBGetKeyValueEx (szKey, "Path", nType, szEnv, nSize);
if (nResult < 0 ) then
MessageBox ("Failed to get the Path Environment Variable", WARNING);
else
if ( szEnv % TARGETDIR ) then
// MessageBox ("Your current Environment Variable \" Path \" is set to: \n" + szEnv + " and already "
// + "contains the PGP 6.5 Command Line for NT executable path.", INFORMATION);
else
//MessageBox ("Your current Environment Variable \" Path \" is set to: \n" + szEnv, INFORMATION);
//Need to add a Semicolon to separate the paths
szEnv = szEnv + ";" + TARGETDIR;
nResult = RegDBSetKeyValueEx (szKey, "Path", REGDB_STRING_EXPAND, szEnv, -1);
if (nResult < 0 ) then
MessageBox ("Failed to Set Environment Variable \" Path \" ", WARNING);
else
// MessageBox (TARGETDIR + "\nHas been appended to you Environment Variable \" Path \". ", INFORMATION);
endif;
endif;
//Flush the NT registry to all applications.
szEnv = "Environment";
pEnv = &szEnv;
SendMessage ( HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
endif;
Enable (LOGGING);
//nResult = CreateRegistrySet( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: SetupFolders
//
// Purpose: This function creates all the folders and shortcuts for the
// setup. This includes program groups and items for Windows 3.1.
//
///////////////////////////////////////////////////////////////////////////////
function SetupFolders()
STRING szTemp, szProgramFolder, szItemName, szCommandLine, szWorkingDir,
szIconPath, szShortCutKey;
NUMBER nResult, nIcon, nFlag;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -