// Test target system for proper configuration.
CheckRequirements();
// Ask user for a destination location for the installation.
GetTargetDirectory:
svTarget = TARGETDISK ^ APPBASE_PATH;
if ( AskDestPath( "", "", svTarget, 0 ) = 12 ) then
goto WelcomeDlg;
endif;
// Perform space check of target drive.
bSpaceOk = TRUE;
if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
szMsg = "There is not enough space available on the disk\n" +
"'" + svTarget + "' \n" +
"Please free up some space or change the target location\n" +
"to a different disk";
MessageBox( szMsg, WARNING );
bSpaceOk = FALSE;
endif;
// If not enough space, ask user to try again.
if (bSpaceOk = FALSE) goto GetTargetDirectory;
TransferFiles:
// Prepare InstallSHIELD to record deinstallation information.
DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
RegDBSetItem( REGDB_UNINSTALL_NAME, PRODUCT_NAME );
// Set up progress indicator and information gauge.
Disable( DIALOGCACHE );
Enable( STATUSDLG );
StatusUpdate( ON, 90 );
// Perform the file set.
SetStatusWindow( 0, "Copying program files..." );
nResult = FileSetPerformEz( szFileSet, 0 );
switch (nResult)
case FS_DONE: // Successful completion.
case FS_CREATEDIR: // Create directory error.
MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
"Please check write access to this directory.", SEVERE );
exit;
default: // Group all other errors under default label.
NumToStr( szTemp, nResult );
MessageBox( "General file transfer error."+
"Please check your target location and try again."+
"\n\n Error Number:"+szTemp +
"\n Related File: "+ERRORFILENAME,
SEVERE );
exit;
endswitch;
Disable( STATUSDLG );
// Create program folders and icons.
InstallProgramItems:
SetStatusWindow( 95, "Creating Program Group and Icons...." );
// UNINST global variable stores the file name (with full path) of
// the uninstaller file.
szProgram = UNINST;
szProgram = szProgram + " -f" + svUninstLogFile;
AddFolderIcon( svFolder, "unInstallSHIELD", szProgram,
WINDIR,
"", 0, "", REPLACE );
Delay( 1 );
// Announce setup complete and offer to read README file.
FinalInstallProcess:
SetStatusWindow( 100, "Installation complete." );
szMsg = "Setup is complete. You may run the installed program "+
"by double-clicking on the program icon installed.";
MessageBox( szMsg, INFORMATION );