%PDF- %PDF-
Direktori : /data/down/eBOOKS/Electric_Circuits_Encyclopedia/ |
Current File : //data/down/eBOOKS/Electric_Circuits_Encyclopedia/Setup.rul |
//Back N Saver Setup Script declare // Constant declarations. #include "sddialog.h" #define SPACE_REQUIRED 13000000 // Disk space in bytes. #define APP_NAME "Encyclopedia of Circuits Suite" #define APPBASE_PATH "Circuits" #define COMPANY_NAME "McGraw-Hill" #define PRODUCT_NAME "Encyclopedia of Circuits Suite" #define PRODUCT_VERSION "1.0" #define DEINSTALL_KEY "CircuitKey" #define UNINSTALL_NAME "Encyclopedia of Circuits Suite" #define PRODUCT_KEY "Circuit" #define PROGRAM_FOLDER_NAME "Encyclopedia of Circuits Suite" // Global variable declarations. STRING svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile; STRING svTarget, szProgram, szParam, szTemp, szAppPath, szRegRoot; STRING szComponents,szMsg1,szMsg2,szHold; STRING szOpt1,szOpt2,szOpt3,szOpt4; BOOL bSpaceOk, bWinNT, bWin32s, bIsShellExplorer; NUMBER nResult,nHold,nSize; // Function declarations. prototype SetupScreen (); prototype CheckRequirements (); program start: Disable( BACKGROUND ); SdProductName(APP_NAME); // Set installation info., which is required for registry entries. InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY ); // Set up the installation screen. SetupScreen(); Enable( DIALOGCACHE ); // Create a Welcome dialog. WelcomeDlg: Disable( BACKBUTTON ); Welcome( "", 0 ); Enable( BACKBUTTON ); // Test target system for proper configuration. CheckRequirements(); // Ask user for a destination location for the installation.-- GetTargetDirectory: // InstallShield sets PROGRAMFILES such that it points to 'Program Files' directory location. if ( PROGRAMFILES = "") then svTarget = TARGETDISK ^ "\\Program Files\\" ^ APPBASE_PATH; else svTarget = PROGRAMFILES ^ APPBASE_PATH; endif; if (AskDestPath( "", szMsg, svTarget, 0 ) = BACK) 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) then goto GetTargetDirectory; endif; // Set the App Paths key for the main program. szAppPath = svTarget; RegDBSetItem( REGDB_APPPATH, szAppPath ); szProgram = svTarget ^ "BackNsaveman.exe"; RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram ); SetupFilesToTransfer: szFileSet = "General"; Enable( STATUSDLG ); // Define the file set. FileSetBeginDefine( szFileSet ); SetStatusWindow( -1, "Copying Encyclopedia files..." ); StatusUpdate( ON, 40 ); TARGETDIR = svTarget ^ "Encyclo"; CompressGet( "DATA.Z", "encyc\\*.*", COMP_NORMAL | INCLUDE_SUBDIR); SetStatusWindow( -1, "Copying SuperCad files..." ); StatusUpdate( ON, 60 ); TARGETDIR = svTarget ^ "SuperCAD"; CompressGet( "DATA.Z", "SuperCAD\\*.*", COMP_NORMAL | INCLUDE_SUBDIR); SetStatusWindow( -1, "Copying SuperPCB files..." ); StatusUpdate( ON, 95 ); TARGETDIR = svTarget ^ "SuperPCB"; CompressGet( "DATA.Z", "SuperPCB\\*.*", COMP_NORMAL | INCLUDE_SUBDIR); TARGETDIR = WINSYSDIR; CompressGet( "DATA.Z", "system\\*.*", COMP_NORMAL); FileSetEndDefine( szFileSet ); TransferFiles: // Prepare InstallShield3 to record deinstallation information. DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 ); RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME ); // Set up progress indicator and information gauge. Disable( DIALOGCACHE ); // Perform the file set. 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 ); abort; 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 ); abort; endswitch; Delay( 1 ); // Create program folders and icons. InstallProgramItems: SetStatusWindow( 99, "Creating Program Folder and Icons...." ); if ( !bIsShellExplorer ) then AppCommand( PROGMAN, CMD_RESTORE ); LongPathToShortPath( svTarget ); endif; svFolder = PROGRAM_FOLDER_NAME; CreateProgramFolder( svFolder ); ShowProgramFolder( svFolder, SW_SHOW ); Delay(1); szProgram = svTarget ^ "supercad\\super.EXE"; if (!bIsShellExplorer) then LongPathToShortPath( szProgram ); else LongPathToQuote( szProgram, TRUE ); endif; AddFolderIcon( svFolder, "SuperCad", szProgram, svTarget ^ "superCAD", "", 0, "", REPLACE ); szProgram = svTarget ^ "superpcb\\spcb.EXE"; if (!bIsShellExplorer) then LongPathToShortPath( szProgram ); else LongPathToQuote( szProgram, TRUE ); endif; AddFolderIcon( svFolder, "SuperPCB", szProgram, svTarget ^ "superPCB", "", 0, "", REPLACE ); szProgram = svTarget ^ "encyclo\\encyc.EXE"; if (!bIsShellExplorer) then LongPathToShortPath( szProgram ); else LongPathToQuote( szProgram, TRUE ); endif; AddFolderIcon( svFolder, "Encyclopia of Circuits", szProgram, svTarget ^ "encyclo", "", 0, "", REPLACE ); szProgram = "winhelp"; szParam = svTarget ^ "encylco\\endoc.hlp"; LongPathToShortPath( szParam); if (!bIsShellExplorer) then LongPathToShortPath( szProgram ); else LongPathToQuote( szProgram, TRUE ); endif; AddFolderIcon( svFolder, "Using the Encyclopedia", szProgram + " " + szParam, "", "", 0, "", REPLACE ); szProgram = "winhelp"; szParam = svTarget ^ "supercad\\sim.hlp"; LongPathToShortPath( szParam); if (!bIsShellExplorer) then LongPathToShortPath( szProgram ); else LongPathToQuote( szProgram, TRUE ); endif; AddFolderIcon( svFolder, "SuperSim Manual", szProgram + " " + szParam, "", "", 0, "", REPLACE ); szProgram = "winhelp"; szParam = svTarget ^ "supercad\\spice.hlp"; LongPathToShortPath( szParam); if (!bIsShellExplorer) then LongPathToShortPath( szProgram ); else LongPathToQuote( szProgram, TRUE ); endif; AddFolderIcon( svFolder, "Spice Manual", szProgram + " " + szParam, "", "", 0, "", REPLACE ); if ( !bIsShellExplorer ) then // Global variable UNINST stores the name and location of the // uninstaller file. szProgram = UNINST; LongPathToShortPath( szProgram ); LongPathToShortPath( svUninstLogFile ); szProgram = szProgram + " -f" + svUninstLogFile; AddFolderIcon( svFolder, "unInstallShield", szProgram, WINDIR, "", 0, "", REPLACE ); Delay( 1 ); endif; // Announce setup complete and offer to read README file.e FinalInstallProcess: SetStatusWindow( 100, "Installation complete." ); szMsg = "Setup is complete"; MessageBox( szMsg, INFORMATION ); exit; /*---------------------------------------------------------------------------*\ * * Function: SetupScreen * * Purpose: This function will set up the screen look. This includes * colors, fonts, text to be displayed, etc. * \*-------------------------------------------------------------------------*/ function SetupScreen() NUMBER nDx, nDy; begin GetExtents( nDx, nDy ); Enable( FULLWINDOWMODE ); Enable( INDVFILESTATUS ); Enable( BITMAP256COLORS ); SetTitle( "Installing " + APP_NAME , 34, WHITE ); SetColor( BACKGROUND, RGB(0,128,128) ); // Dark blue. SetColor( STATUSBAR, BLUE ); // Bright blue. SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text. Enable( BACKGROUND ); Delay( 1 ); end; /*---------------------------------------------------------------------------*\ * * Function: CheckRequirements * * Purpose: This function will check all minimum requirements for the * application being installed. If any fail, then the user * is informed and the installation is terminated. * \*---------------------------------------------------------------------------*/ function CheckRequirements() NUMBER nvDx, nvDy, nvResult; STRING svResult; begin // Check screen resolution. GetExtents( nvDx, nvDy ); if (nvDy < 480) then MessageBox( "This program requires VGA or better resolution.", WARNING ); abort; endif; // Determine the target system's operating system. GetSystemInfo( OS, nvResult, svResult ); bWinNT = FALSE; bWin32s = FALSE; bIsShellExplorer = FALSE; if (nvResult = IS_WINDOWSNT) then bWinNT = TRUE; // Running Windows NT. // Check to see if the shell being used is EXPLORER shell. if (( nvResult = IS_WINDOWSNT ) || ( nvResult = IS_WINDOWS95 )) then if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then if (nvResult >= 4) then bIsShellExplorer = TRUE; endif; endif; endif; elseif (nvResult = IS_WIN32S) then bWin32s = TRUE; // Running Win32s. elseif (nvResult = IS_WINDOWS95 ) then bIsShellExplorer = TRUE; endif; end; #include "sddialog.rul" // Source file IS3UG044.RUL