home *** CD-ROM | disk | FTP | other *** search
/ German history - 1949 to 2000 / 0010121246.iso.zip / 0010121246.iso / setup.rul < prev    next >
Text File  |  2000-08-31  |  9KB  |  296 lines

  1. // ************************************************************************************
  2. // * Olzog Update
  3. // ************************************************************************************
  4.  
  5.  
  6. declare
  7.  
  8. /* #include "sddialog.h" */
  9.  
  10. // Constant declarations.
  11. #define SPACE_REQUIRED          4358124          // Disk space in bytes.
  12. #define APP_NAME                "Olzog Geschichte"
  13. #define PROGRAM_FOLDER_NAME     "Olzog"
  14. #define APPBASE_PATH            "\\Olzog"
  15. #define APPBASE_PATH_WIN32S     "\\Olzog"
  16. #define COMPANY_NAME            "Olzog"
  17. #define PRODUCT_NAME            "Olzog"
  18. #define PRODUCT_VERSION         "97"
  19. #define DEINSTALL_KEY           "Olzog - Geschichte"
  20. #define UNINSTALL_NAME          "Olzog2000"
  21. #define PRODUCT_KEY             "Olzog"
  22.  
  23.         // Global variable declarations.
  24.         STRING  svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
  25.         STRING  svTarget, szProgram, szParam, szTemp, szAppPath;
  26.         BOOL    bSpaceOk, bWinNT, bWin32s, bWin311, bIsShellExplorer;
  27.         NUMBER  nResult;
  28.  
  29.         STRING  szPath, svResult;
  30.     STRING  svNFO, svDate;
  31.     STRING  sTmp;
  32.     NUMBER  nvSize;
  33.     
  34.  
  35.     STRING svString, szOutput;
  36.     NUMBER nDriveType, nDriveMinSpace
  37.     LIST listID;
  38.  
  39.     STRING sEin, sAus, altDir;
  40.  
  41.         // Function declarations.
  42.         prototype SetupScreen();
  43.         prototype CheckRequirements();
  44.  
  45. program
  46.     
  47. StartHere:
  48.         Disable( BACKGROUND );
  49.  
  50.         // Set installation info., which is required for registry entries.
  51.         InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
  52.  
  53.         // Set up the installation screen.
  54.         SetupScreen();
  55.         Enable( DIALOGCACHE );
  56.  
  57.  
  58.    // Create a Welcome dialog.
  59.    WelcomeDlg:
  60.         Disable( BACKBUTTON );
  61.         Welcome( "", 0 );
  62.         Enable( BACKBUTTON );
  63.  
  64.         // Test target system for proper configuration.
  65.         CheckRequirements();
  66.  
  67.  
  68.         // Ask user for a destination location for the installation.
  69.    GetTargetDirectory:
  70.         svTarget = TARGETDISK ^ APPBASE_PATH;
  71.  
  72.         if ( AskDestPath( "", "", svTarget, 0 ) = BACK ) then
  73.            goto WelcomeDlg;
  74.         endif;
  75.  
  76.         // Perform space check of target drive.
  77.         bSpaceOk = TRUE;
  78.         if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
  79.            szMsg = "Auf dem Laufwerk \n" +
  80.                    "'" + svTarget + "' \n" +
  81.                    "ist nicht genⁿgend Platz vorhanden. Bitte schaffen Sie mehr Platz\n" +
  82.                    "oder wΣhlen Sie ein anderes Laufwerk.";
  83.            MessageBox( szMsg, WARNING );
  84.            bSpaceOk = FALSE;
  85.         endif;
  86.  
  87.         // If not enough space, ask user to try again.
  88.         if (bSpaceOk = FALSE) goto GetTargetDirectory;
  89.  
  90.  
  91.    SetupFilesToTransfer:
  92.         Disable( DIALOGCACHE );
  93.         szFileSet = "General";
  94.         TARGETDIR = svTarget;
  95.  
  96.         // Define the file set.
  97.         FileSetBeginDefine( szFileSet );
  98.  
  99.            SetStatusWindow( -1, "Copying program files..." );
  100.            CompressGet( "DATA.Z", "*.*", INCLUDE_SUBDIR );
  101.  
  102.         FileSetEndDefine( szFileSet );
  103.  
  104.  
  105.    TransferFiles:
  106.         // Prepare InstallSHIELD to record deinstallation information.
  107.         DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
  108.         RegDBSetItem( REGDB_UNINSTALL_NAME, PRODUCT_NAME );
  109.  
  110.         // Set up progress indicator and information gauge.
  111.         Disable( DIALOGCACHE );
  112.         Enable( STATUSDLG );
  113.  
  114.         StatusUpdate( ON, 90 );
  115.  
  116.         // Perform the file set.
  117.         SetStatusWindow( 0, "Copying program files..." );
  118.         nResult = FileSetPerformEz( szFileSet, 0 );
  119.  
  120.         switch (nResult)
  121.  
  122.         case FS_DONE: // Successful completion.
  123.  
  124.         case FS_CREATEDIR: // Create directory error.
  125.              MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
  126.                          "Please check write access to this directory.", SEVERE );
  127.              exit;
  128.  
  129.         default: // Group all other errors under default label.
  130.              NumToStr( szTemp, nResult );
  131.              MessageBox( "General file transfer error."+
  132.                           "Please check your target location and try again."+
  133.                           "\n\n Error Number:"+szTemp +
  134.                           "\n Related File: "+ERRORFILENAME,
  135.                           SEVERE );
  136.  
  137.              exit;
  138.         endswitch;
  139.  
  140.         Disable( STATUSDLG );
  141.  
  142.    // Create program folders and icons.
  143.    InstallProgramItems:
  144.         SetStatusWindow( 95, "Erzeuge Programmgruppe und Ikone...." );
  145.  
  146.         AppCommand( PROGMAN, CMD_RESTORE );
  147.         svFolder = PROGRAM_FOLDER_NAME;
  148.  
  149.         CreateProgramFolder( svFolder );
  150.         Delay(1);
  151.  
  152.         szProgram = svTarget ^ "XSEARCH.EXE";
  153.  
  154.         ShowProgramFolder( svFolder, SW_SHOW );
  155.  
  156.         AddFolderIcon( svFolder, APP_NAME,
  157.                        szProgram,
  158.                        "",
  159.                        "", 0, "", REPLACE );
  160.         Delay( 1 );
  161.  
  162.  
  163.         // Ini Datei 
  164.         WriteProfString( svTarget ^ "OLZOG.INI", "Installation", "CD", SRCDIR );
  165.         Delay( 1 );
  166.         
  167.         WriteProfString( svTarget ^ "OLZOG.INI", "Installation", "EndVersion", "1" );
  168.         Delay( 1 );
  169.  
  170.         // UNINST global variable stores the file name (with full path) of
  171.         // the uninstaller file.
  172.         szProgram = UNINST;
  173.         szProgram = szProgram + " -f" + svUninstLogFile;
  174.         AddFolderIcon( svFolder, "unInstallSHIELD", szProgram,
  175.                        WINDIR,
  176.                        "", 0, "", REPLACE );
  177.         Delay( 1 );
  178.  
  179.         AddFolderIcon( svFolder, "Readme ",
  180.                        "NOTEPAD.EXE " + svTarget ^ "README.TXT",
  181.                        svTarget,
  182.                        "", 0, "", REPLACE );
  183.         Delay( 1 );
  184.  
  185.    // Announce setup complete and offer to read README file.
  186.    FinalInstallProcess:
  187.         SetStatusWindow( 100, "Installation vollstΣndig." );
  188.  
  189.         if ( bWin311 ) then
  190.             szMsg = "Das Setup ist vollstΣndig ausgefⁿhrt.\nBitte installieren Sie nun Video for Windows\n" + 
  191.                     "Sie k÷nnen die Installation ⁿber die EXIT Taste abbrechen";
  192.             MessageBox( szMsg, INFORMATION );
  193.             
  194.             LaunchApp ( SRCDIR ^ "VFW/DISK1/SETUP.EXE", "" );
  195.         else
  196.             szMsg = "Das Setup ist vollstΣndig ausgefⁿhrt.";
  197.             MessageBox( szMsg, INFORMATION );
  198.         endif;
  199.  
  200.         LaunchApp ( "NOTEPAD.EXE", svTarget ^ "README.TXT" );
  201.  
  202.         exit;
  203.  
  204. /*---------------------------------------------------------------------------*\
  205.  *
  206.  * Function:  SetupScreen
  207.  *
  208.  *  Purpose:  This function will set up the screen look.  This includes
  209.  *            colors, fonts, text to be displayed, etc.
  210.  *
  211.  *
  212.  *    Input:
  213.  *
  214.  *  Returns:
  215.  *
  216.  * Comments:
  217. \*---------------------------------------------------------------------------*/
  218. function SetupScreen()
  219.         number nDx, nDy;
  220. begin
  221.         GetExtents( nDx, nDy );
  222.  
  223.         Enable( FULLWINDOWMODE );
  224.         Enable( INDVFILESTATUS );
  225.         Enable( BITMAP256COLORS );
  226.  
  227.         SetTitle( "Installiere " + APP_NAME, 24, WHITE );
  228.  
  229.         SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
  230.         SetColor( STATUSBAR, BLUE );     // Bright blue.
  231.         SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
  232.  
  233.         Enable( BACKGROUND );
  234.  
  235.         Delay( 1 );
  236.  
  237. end;
  238.  
  239.  
  240. /*---------------------------------------------------------------------------*\
  241.  *
  242.  * Function:  CheckRequirements
  243.  *
  244.  *  Purpose:  This function will check all minimum requirements for the
  245.  *            application being installed.  If any fail, then the user
  246.  *            is informed and the installation is terminated.
  247.  *
  248.  *
  249.  *    Input:
  250.  *
  251.  *  Returns:
  252.  *
  253.  * Comments:
  254. \*---------------------------------------------------------------------------*/
  255. function CheckRequirements()
  256. number nvDx, nvDy;
  257. number nvResult;
  258. STRING svResult;
  259.  
  260. begin
  261.  
  262.         // Check screen resolution.
  263.         GetExtents( nvDx, nvDy );
  264.         if (nvDy < 480) then
  265.            MessageBox( "This program requires VGA or better resolution.", WARNING );
  266.            exit;
  267.         endif;
  268.  
  269.         // Determine the target system's operating system.
  270.         GetSystemInfo( OS, nvResult, svResult );
  271.         bWinNT  = FALSE;
  272.         bWin32s = FALSE;
  273.         bWin311 = FALSE;
  274.         bIsShellExplorer = FALSE;
  275.  
  276.         if (nvResult =  IS_WINDOWS ) then
  277.             bWin311 = TRUE;
  278.         endif;
  279.         
  280.         if (nvResult =  IS_WINDOWSNT) then
  281.            bWinNT = TRUE; // Running Windows NT.
  282.  
  283.            // Check to see if NT is using EXPLORER Shell
  284.            if( QueryShellMgr( svResult ) = 0 ) then
  285.                if( StrCompare( svResult, "EXPLORER.EXE" ) = 0 ) then
  286.                    bIsShellExplorer = TRUE;
  287.                endif;
  288.            endif;
  289.  
  290.         elseif (nvResult =  IS_WIN32S) then
  291.            bWin32s = TRUE; // Running Win32s.
  292.         endif;
  293.  
  294. end;
  295.  
  296.