home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / appcraks / F_GANTT.ZIP / SETUP.RUL < prev   
Text File  |  1998-01-17  |  9KB  |  274 lines

  1. /*----------------------------------------------------------------------------*\
  2.  *
  3.  *  Copyright (c) 1998 Free Field Inc.
  4.  *
  5.  *    File Name:  SETUP.RUL
  6.  *
  7.  *  Description:  Gantt/OCX Upgrade Version 1.10 (Dec. 15, 1997)
  8.  *                Installation script.
  9.  *
  10.  *
  11.  *       Author:  Lover Boy       Date:  1-17-98
  12.  *
  13.  *
  14. \*----------------------------------------------------------------------------*/
  15.  
  16.  
  17. declare
  18.  
  19. // Constant declarations.
  20. #define SPACE_REQUIRED          100000          // Disk space in bytes.
  21. #define APP_NAME                "Gantt/OCX"
  22. #define PROGRAM_FOLDER_NAME     "GanttOCX"
  23. #define APPBASE_PATH            "Program Files\\Free Field\\GanttOCX\\"
  24.  
  25. #define COMPANY_NAME            "Free Field Inc."
  26. #define PRODUCT_NAME            "GanttOCX"
  27. #define PRODUCT_VERSION         "1.1"
  28. #define DEINSTALL_KEY           "SampleDeinstKey"
  29. #define PRODUCT_KEY             "myapp.exe"
  30.  
  31.         // Global variable declarations.
  32.         STRING  svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
  33.         STRING  svTarget[ 255 ], szProgram, szTemp[ 255 ];
  34.         BOOL    bSpaceOk;
  35.         NUMBER  nResult;
  36.  
  37.         // Function declarations.
  38.         prototype SetupScreen();
  39.         prototype CheckRequirements();
  40.  
  41. program
  42.  
  43. StartHere:
  44.         Disable( BACKGROUND );
  45.  
  46.         // Set installation info., which is required for registry entries.
  47.         InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
  48.  
  49.         // Set up the installation screen.
  50.         SetupScreen();
  51.         Enable( DIALOGCACHE );
  52.  
  53.  
  54.    // Create a Welcome dialog.
  55.    WelcomeDlg:
  56.         Disable( BACKBUTTON );
  57.         Welcome( "", 0 );
  58.         Enable( BACKBUTTON );
  59.  
  60.         // Test target system for proper configuration.
  61.         CheckRequirements();
  62.  
  63.  
  64.         // Ask user for a destination location for the installation.
  65.    GetTargetDirectory:
  66.         svTarget = TARGETDISK ^ APPBASE_PATH;
  67.  
  68.         if ( AskDestPath( "", "", svTarget, 0 ) = 12 ) then
  69.            goto WelcomeDlg;
  70.         endif;
  71.  
  72.         // Perform space check of target drive.
  73.         bSpaceOk = TRUE;
  74.         if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
  75.            szMsg = "There is not enough space available on the disk\n" +
  76.                    "'" + svTarget + "' \n" +
  77.                    "Please free up some space or change the target location\n" +
  78.                    "to a different disk";
  79.            MessageBox( szMsg, WARNING );
  80.            bSpaceOk = FALSE;
  81.         endif;
  82.  
  83.         // If not enough space, ask user to try again.
  84.         if (bSpaceOk = FALSE) goto GetTargetDirectory;
  85.  
  86.  
  87.    SetupFilesToTransfer:
  88.         Disable( DIALOGCACHE );
  89.         szFileSet = "General";
  90.         TARGETDIR = svTarget;
  91.  
  92.         // Define the file set.
  93.         FileSetBeginDefine( szFileSet );
  94.  
  95.            SetStatusWindow( -1, "Copying program files..." );
  96.            CompressGet( "DATA.Z", "*.*", INCLUDE_SUBDIR );
  97.  
  98.         FileSetEndDefine( szFileSet );
  99.  
  100.  
  101.    TransferFiles:
  102.         // Prepare InstallSHIELD to record deinstallation information.
  103.         DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
  104.         RegDBSetItem( REGDB_UNINSTALL_NAME, PRODUCT_NAME );
  105.  
  106.         // Set up progress indicator and information gauge.
  107.         Disable( DIALOGCACHE );
  108.         Enable( STATUSDLG );
  109.  
  110.         StatusUpdate( ON, 90 );
  111.  
  112.         // Perform the file set.
  113.         SetStatusWindow( 0, "Copying program files..." );
  114.         nResult = FileSetPerformEz( szFileSet, 0 );
  115.  
  116.         switch (nResult)
  117.  
  118.         case FS_DONE: // Successful completion.
  119.  
  120.         case FS_CREATEDIR: // Create directory error.
  121.              MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
  122.                          "Please check write access to this directory.", SEVERE );
  123.              exit;
  124.  
  125.         default: // Group all other errors under default label.
  126.              NumToStr( szTemp, nResult );
  127.              MessageBox( "General file transfer error."+
  128.                           "Please check your target location and try again."+
  129.                           "\n\n Error Number:"+szTemp +
  130.                           "\n Related File: "+ERRORFILENAME,
  131.                           SEVERE );
  132.  
  133.              exit;
  134.         endswitch;
  135.  
  136.         Disable( STATUSDLG );
  137.  
  138.    // Create program folders and icons.
  139.    InstallProgramItems:
  140.         SetStatusWindow( 95, "Creating Program Group and Icons...." );
  141.  
  142.         AppCommand( PROGMAN, CMD_RESTORE );
  143.         svFolder = PROGRAM_FOLDER_NAME;
  144.  
  145.         CreateProgramFolder( svFolder );
  146.         Delay(1);
  147.  
  148.         szProgram = svTarget ^ "README\\README.WRI";
  149.  
  150.         ShowProgramFolder( svFolder, SW_SHOW );
  151.  
  152.         AddFolderIcon( svFolder, APP_NAME,
  153.                        szProgram,
  154.                        svTarget ^ "Readme",
  155.                        "", 0, "", REPLACE );
  156.  
  157.         AddFolderIcon( svFolder, "Sample1",
  158.                        svTarget ^ "SAMPLES\\SAMPLE1\\SAMPLE1.VBP",
  159.                        svTarget ^ "SAMPLES\\SAMPLE1",
  160.                        "", 0, "", REPLACE );
  161.  
  162.         AddFolderIcon( svFolder, "Sample2",
  163.                        svTarget ^ "SAMPLES\\SAMPLE2\\SAMPLE2.VBP",
  164.                        svTarget ^ "SAMPLES\\SAMPLE2",
  165.                        "", 0, "", REPLACE );
  166.  
  167.         AddFolderIcon( svFolder, "Sample3",
  168.                        svTarget ^ "SAMPLES\\SAMPLE3\\SAMPLE3.VBP",
  169.                        svTarget ^ "SAMPLES\\SAMPLE3",
  170.                        "", 0, "", REPLACE );
  171.  
  172.         AddFolderIcon( svFolder, "Sample4",
  173.                        svTarget ^ "SAMPLES\\SAMPLE4\\SAMPLE4.VBP",
  174.                        svTarget ^ "SAMPLES\\SAMPLE4",
  175.                        "", 0, "", REPLACE );
  176.  
  177.         AddFolderIcon( svFolder, "Sample5",
  178.                        svTarget ^ "SAMPLES\\SAMPLE5\\SAMPLE5.VBP",
  179.                        svTarget ^ "SAMPLES\\SAMPLE5",
  180.                        "", 0, "", REPLACE );
  181.         Delay( 1 );
  182.  
  183.         LaunchApp( "REGSVR32.EXE", "/s " + svTarget ^ "Ocx\\ganttocx.ocx" );
  184.  
  185.         // UNINST global variable stores the file name (with full path) of
  186.         // the uninstaller file.
  187.         szProgram = UNINST;
  188.         szProgram = szProgram + " -f" + svUninstLogFile;
  189.         AddFolderIcon( svFolder, "unInstallSHIELD", szProgram,
  190.                        WINDIR,
  191.                        "", 0, "", REPLACE );
  192.         Delay( 1 );
  193.  
  194.    // Announce setup complete and offer to read README file.
  195.    FinalInstallProcess:
  196.         SetStatusWindow( 100, "Installation complete." );
  197.  
  198.         szMsg = "Setup is complete.  You may run the installed program "+
  199.                 "by double-clicking on the program icon installed.";
  200.         MessageBox( szMsg, INFORMATION );
  201.  
  202.         exit;
  203.  
  204.  
  205. /*---------------------------------------------------------------------------*\
  206.  *
  207.  * Function:  SetupScreen
  208.  *
  209.  *  Purpose:  This function will set up the screen look.  This includes
  210.  *            colors, fonts, text to be displayed, etc.
  211.  *
  212.  *
  213.  *    Input:
  214.  *
  215.  *  Returns:
  216.  *
  217.  * Comments:
  218. \*---------------------------------------------------------------------------*/
  219.  
  220. function SetupScreen()
  221.         number nDx, nDy;
  222. begin
  223.         GetExtents( nDx, nDy );
  224.  
  225.         Enable( FULLWINDOWMODE );
  226.  
  227.         Enable( INDVFILESTATUS );
  228.         Enable( BITMAP256COLORS );
  229.         Enable( DIALOGCACHE );
  230.  
  231.         SetTitle( "Installing " + APP_NAME, 24, WHITE );
  232.  
  233.         SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
  234.         SetColor( STATUSBAR, BLUE );            // Bright blue.
  235.  
  236.         SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
  237.  
  238.         Enable( BACKGROUND );
  239.  
  240.         Delay( 1 );
  241.  
  242. end;
  243.  
  244.  
  245. /*---------------------------------------------------------------------------*\
  246.  *
  247.  * Function:  CheckRequirements
  248.  *
  249.  *  Purpose:  This function will check all minimum requirements for the
  250.  *            application being installed.  If any fail, then the user
  251.  *            is informed and the installation is terminated.
  252.  *
  253.  *
  254.  *    Input:
  255.  *
  256.  *  Returns:
  257.  *
  258.  * Comments:
  259. \*---------------------------------------------------------------------------*/
  260.  
  261. function CheckRequirements()
  262. number  nvDx, nvDy;
  263. number nvVersion;
  264. STRING szResult;
  265. begin
  266.         // Check screen resolution.
  267.         GetExtents( nvDx, nvDy );
  268.         if (nvDy < 480) then
  269.            MessageBox( "This program requires VGA or better resolution.", WARNING );
  270.            exit;
  271.         endif;
  272. end;
  273.  
  274.