home *** CD-ROM | disk | FTP | other *** search
/ Popular Mechanics - New Car Buyers Guide 1995 / Popular_Mechanics_New_Car_Buyers_Guide_1995_Books_That_Work_1994.iso / setup / carguide.mst < prev    next >
Text File  |  1995-01-20  |  25KB  |  777 lines

  1. '**************************************************************************
  2. '*
  3. '* CARGUIDE.MST - Car & Truck Setup Script
  4. '*
  5. '**************************************************************************
  6.     
  7.     '' Global variables
  8.  
  9.     GLOBAL TitleName$
  10.     GLOBAL TheTitleName$
  11.     GLOBAL CapTheTitleName$
  12.     GLOBAL FullName$
  13.     GLOBAL SeriesName$
  14.     GLOBAL TitleVersion$
  15.     GLOBAL ShortName$
  16.     GLOBAL MVBFileName$
  17.     GLOBAL ProgManGroup$
  18.     GLOBAL ProgManItem$
  19.     GLOBAL DefaultPath$
  20.     GLOBAL BTWDir$
  21.     GLOBAL TitleDir$
  22.     GLOBAL HowToDir$
  23.     GLOBAL ProgramDir$
  24.     GLOBAL DataDir$
  25.     GLOBAL CDDrive$
  26.     GLOBAL CDTitleDir$
  27.     GLOBAL SetupSrcDir$
  28.     GLOBAL ModemRegDir$
  29.     GLOBAL PromosDir$
  30.     GLOBAL SystemDir$
  31.  
  32.     '' ****************************************************************
  33.     '' ** Setup Variables
  34.     '' ****************************************************************
  35.  
  36.     TitleName$ = "New Car Buyers Guide"
  37.     TheTitleName$ = "the " + TitleName$
  38.     CapTheTitleName$ = "The " + TitleName$
  39.     FullName$ = "Popular Mechanics New Car Buyers Guide - 1995"
  40.     SeriesName$ = "Home Survival Toolkit"
  41.     TitleVersion$ = "1.11"
  42.     MVBFileName$ = "CARFIRST"
  43.     ShortName$ = "CARGUIDE"
  44.     ProgManGroup$ = "Books That Work"
  45.     ProgManItem$ = TitleName$
  46.  
  47.     '***********************************************************************
  48.     '** Mainline
  49.     '***********************************************************************
  50.  
  51.     GLOBAL CUIDLL$
  52.  
  53.     '' Include files
  54.     '$INCLUDE 'setupapi.inc'
  55.     '$INCLUDE 'msdetect.inc'
  56.     '$INCLUDE 'msregdb.inc'
  57.  
  58.     '' Custom UI dll
  59.     CUIDLL$ = "mscuistf.dll"
  60.     
  61.     '' Dialog ID's
  62.     CONST DESTPATH      = 1000
  63.     CONST APPHELP       = 2000
  64.     CONST TOOBIG        = 3000
  65.     CONST BADPATH       = 4000
  66.     CONST SUCCESS       = 5000
  67.     CONST WELCOME       = 6000
  68.     CONST NOWIN31       = 7000
  69.     CONST TOOBIG2       = 8000
  70.     CONST SYSREQ        = 9000
  71.     CONST BBOARDCD      = 18000
  72.     CONST TTDISABLED    = 23000
  73.     CONST NOENHANCED    = 25000
  74.     CONST NO386            = 26000
  75.     CONST MODEMREG      = 27000
  76.  
  77.     '' Bitmap ID
  78.     CONST LOGO = 1
  79.     
  80.     '' Functions and subroutines
  81.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  82.     DECLARE FUNCTION IsTrueTypeEnabled LIB "mscuistf.dll" () AS INTEGER
  83.     DECLARE SUB RestartWindows LIB "mscuistf.dll"
  84.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  85.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  86.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  87.     DECLARE SUB UpgradeBTWIni
  88.     DECLARE SUB BTWMaximize LIB "mscuistf.dll" (iHwnd%)
  89.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  90.     DECLARE SUB ModifyBTWIni
  91.     DECLARE SUB ModifyViewerIni
  92.     DECLARE SUB RegisterCustomFonts
  93.     DECLARE SUB ModifyProgramManager
  94.     DECLARE SUB ModifyRegDatabase
  95.     DECLARE SUB ShowSuccess
  96.     DECLARE SUB AddBillboards
  97.     DECLARE FUNCTION ShowWelcome AS INTEGER
  98.     DECLARE FUNCTION CheckWindowsVersion AS INTEGER
  99.     DECLARE SUB DoModemRegistration
  100.  
  101.     '' The following statement turns size checking off. Set it to scmOnFatal
  102.     '' to enable size checking, where Setup will compare the disk file size
  103.     '' with the INF file size and report an error if they are not the same.
  104.     
  105.     i% = SetSizeCheckMode(scmOnFatal)
  106.     
  107.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  108.     '' alter the banner bitmap.
  109.     
  110.     BTWMaximize(HwndFrame())
  111.     SetTitle FullName$
  112.     SetBitmap CUIDLL$, LOGO 
  113.     
  114.     '' Welcome dialog
  115.     IF ShowWelcome() = 0 THEN
  116.         GOTO QUIT
  117.     ENDIF
  118.  
  119.     '' Check windows version
  120.     IF CheckWindowsVersion() = 0 THEN
  121.         GOTO QUIT
  122.     ENDIF
  123.  
  124.     '' Upgrade the BTW.INI file from Deck format to new format.
  125.     UpgradeBTWIni
  126.  
  127.     '' Decide where to put title files
  128.     DefaultPath$ = GetIniKeyString("BTW.INI", "General", "BTW Directory")
  129.  
  130.     IF DefaultPath$ = "" THEN
  131.  
  132.         GetLocalHardDrivesList("LocalHardDrives")
  133.  
  134.         szLocalHardDrive$ = GetListItem("LocalHardDrives", 1)
  135.  
  136.         IF szLocalHardDrive$ = "" THEN
  137.             szLocalHardDrive$ = "C"
  138.         ENDIF
  139.  
  140.         DefaultPath$ = szLocalHardDrive$ + ":\BTW"
  141.  
  142.     ENDIF
  143.     
  144. TRYAGAIN:
  145.  
  146.     BTWDir$ = GetTitleDir(DefaultPath$)
  147.     IF BTWDir$ = "" THEN
  148.         GOTO QUIT
  149.     ENDIF
  150.     
  151.     TitleDir$ = MakePath(BTWDir$, ShortName$)
  152.     CDDrive$ = MID$(GetSymbolValue("STF_SRCDIR"), 1, 1)
  153.     CDTitleDir$ = GetSymbolValue("STF_SRCDIR")
  154.     HowToDir$ = MakePath(CDTitleDir$, "HOWTO")
  155.     ProgramDir$ = MakePath(CDTitleDir$, "SHOWROOM")
  156.     DataDir$ = MakePath(CDTitleDir$, "DATA")
  157.     ModemRegDir$ = MakePath(BTWDir$, "MODEMREG")
  158.     PromosDir$ = MakePath(BTWDir$, "PROMOS")
  159.     
  160.     SetupSrcDir$ = MakePath(GetSymbolValue("STF_SRCDIR"), "SETUP")
  161.     
  162.     '' If Windows is shared, place system files in the Windows directory.
  163.     IF IsWindowsShared() = 1 THEN
  164.         SystemDir$ = GetWindowsDir()
  165.     ELSE
  166.         SystemDir$ = GetWindowsSysDir()
  167.     ENDIF
  168.     
  169.     '' Read in the INF file.
  170.     ReadInfFile GetSymbolValue("STF_CWDDIR") + ShortName$ + ".INF"
  171.  
  172.     '' Copy files
  173.     iVal% = CopyFiles(TitleDir$)
  174.     IF iVal% = 0 THEN
  175.         GOTO QUIT
  176.     ELSEIF iVal% = -1 THEN
  177.         GOTO TRYAGAIN
  178.     ENDIF
  179.  
  180.  
  181.     '' Register in BTW.INI
  182.     ModifyBTWIni
  183.  
  184.     '' Register in VIEWER.INI
  185.     ModifyViewerIni
  186.  
  187.     '' Modify Program Manager
  188.     ModifyProgramManager    
  189.  
  190.     '' Add entries to registration database.
  191.     ModifyRegDatabase
  192.  
  193.     '' Register custom fonts.
  194.     '' This must be last, since it may restart Windows!!!
  195.     RegisterCustomFonts
  196.  
  197.     '' Modem registration
  198.     DoModemRegistration
  199.     
  200.     '' Success dialog
  201.     ShowSuccess
  202.     
  203. QUIT:
  204.     
  205.     END
  206.     
  207.  
  208. '*************************************************************************
  209. '** Purpose:
  210. '**     Puts up a welcome dialog
  211. '*************************************************************************
  212.  
  213. FUNCTION ShowWelcome () STATIC AS INTEGER
  214.  
  215.     WELCOME:
  216.     
  217.     SetSymbolValue "String", TheTitleName$
  218.     SetSymbolValue "String1", FullName$
  219.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, "FHelpDlgProc")
  220.     
  221.     IF sz$ = "CONTINUE" THEN
  222.         ShowWelcome = 1
  223.     
  224.     ELSEIF sz$ = "REACTIVATE" THEN
  225.         GOTO WELCOME
  226.     
  227.     ELSE
  228.         ShowWelcome = 0
  229.     
  230.     ENDIF
  231.     
  232.     UIPop 1
  233.     
  234.     
  235. END FUNCTION
  236.  
  237.  
  238. '*************************************************************************
  239. '** Purpose:
  240. '**     Check the windows version
  241. '*************************************************************************
  242.  
  243. FUNCTION CheckWindowsVersion () STATIC AS INTEGER
  244.  
  245.     IF GetProcessorType() < 3 THEN
  246.  
  247.         NO386:
  248.         SetSymbolValue "String", TheTitleName$
  249.         SetSymbolValue "String1", TheTitleName$
  250.         sz$ = UIStartDlg(CUIDLL$, NO386, "FInfoDlgProc", SYSREQ, "FHelpDlgProc")
  251.         
  252.         IF sz$ = "REACTIVATE" THEN
  253.             GOTO NO386
  254.         ENDIF
  255.         
  256.         UIPop 1
  257.         
  258.         CheckWindowsVersion = 0
  259.  
  260.     ELSEIF GetWindowsMajorVersion() < 3 OR GetWindowsMinorVersion() < 10 THEN
  261.     
  262.         NOWIN31:
  263.         SetSymbolValue "String", TheTitleName$
  264.         SetSymbolValue "String1", CapTheTitleName$
  265.         SetSymbolValue "String2", LTRIM$(STR$(GetWindowsMajorVersion())) + "." + LTRIM$(STR$(GetWindowsMinorVersion()))
  266.         sz$ = UIStartDlg(CUIDLL$, NOWIN31, "FInfoDlgProc", SYSREQ, "FHelpDlgProc")
  267.         
  268.         IF sz$ = "REACTIVATE" THEN
  269.             GOTO NOWIN31
  270.         ENDIF
  271.         
  272.         UIPop 1
  273.         
  274.         CheckWindowsVersion = 0
  275.  
  276.     ELSEIF GetWindowsMode() < 2 THEN
  277.  
  278.         NOENHANCED:
  279.         SetSymbolValue "String", TheTitleName$
  280.         SetSymbolValue "String1", TheTitleName$
  281.         sz$ = UIStartDlg(CUIDLL$, NOENHANCED, "FInfoDlgProc", SYSREQ, "FHelpDlgProc")
  282.         
  283.         IF sz$ = "REACTIVATE" THEN
  284.             GOTO NOENHANCED
  285.         ENDIF
  286.         
  287.         UIPop 1
  288.         
  289.         CheckWindowsVersion = 0
  290.  
  291.     ELSE
  292.         CheckWindowsVersion = 1
  293.     ENDIF
  294.     
  295. END FUNCTION
  296.  
  297.  
  298. '*************************************************************************
  299. '** Purpose:
  300. '**     Prompts the user for a path for the title files
  301. '** Arguments:
  302. '**     szDefault$ - default path
  303. '** Returns:
  304. '**     New valid path name, or "" if the user quit.
  305. '*************************************************************************
  306.  
  307. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  308.  
  309.     SetSymbolValue "String", TheTitleName$
  310.     SetSymbolValue "EditTextIn", szDefault$
  311.     SetSymbolValue "EditFocus", "ALL"
  312.  
  313.     GETPATH:
  314.  
  315.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  316.  
  317.     IF sz$ = "CONTINUE" THEN
  318.         szTitleDir$ = GetSymbolValue("EditTextOut")
  319.         IF IsDirWritable(szTitleDir$) = 0 THEN
  320.  
  321.             BADPATH:
  322.  
  323.             SetSymbolValue "String", TheTitleName$
  324.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", APPHELP, "FHelpDlgProc")
  325.             IF sz$ = "REACTIVATE" THEN
  326.                 GOTO BADPATH
  327.             ENDIF
  328.             UIPop 1
  329.             GOTO GETPATH
  330.         ENDIF
  331.         UIPop 1
  332.         CreateDir szTitleDir$, cmoNone
  333.  
  334.     ELSEIF sz$ = "REACTIVATE" THEN
  335.         GOTO GETPATH
  336.  
  337.     ELSE
  338.         szTitleDir$ = ""
  339.  
  340.     ENDIF
  341.  
  342.     GetTitleDir = szTitleDir$
  343.  
  344. END FUNCTION
  345.  
  346.  
  347. '*************************************************************************
  348. '** Purpose:
  349. '**     Add billboards to the billboard list
  350. '*************************************************************************
  351.  
  352. SUB AddBillboards STATIC
  353.  
  354.     ClearBillBoardList
  355.  
  356.     AddToBillBoardList CUIDLL$, BBOARDCD, "FModelessDlgProc",10
  357.  
  358. END SUB
  359.  
  360.  
  361. '*************************************************************************
  362. '** Purpose:
  363. '**     Copies the files in the INF file
  364. '** Arguments:
  365. '**     szTitleDir$ - destination directory for the title files
  366. '** Returns
  367. '**     1 if files were copied, 0 otherwise
  368. '*************************************************************************
  369.  
  370. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  371.  
  372.     '' Check size
  373.     szExtras$ = "Extra"
  374.     szCosts$ = "Costs"
  375.     szNeededs$ = "Neededs"
  376.     FOR i% = 1 TO 26 STEP 1
  377.         AddListItem szExtras$, "0"
  378.     NEXT i%
  379.     
  380.     '' Add all system files to the copy list
  381.     ClearCopyList
  382.  
  383.     AddSectionFilesToCopyList "System Files", SetupSrcDir$, SystemDir$
  384.     
  385.     '' Get the amount of space required in the windows system directory.
  386.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  387.     
  388.     '' Put up a message if there is not enough space.
  389.     FOR i% = 1 TO 26 STEP 1
  390.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  391.     
  392.             SetSymbolValue "String", TheTitleName$
  393.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  394.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  395.  
  396.             TOOBIG:
  397.     
  398.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", SYSREQ, "FHelpDlgProc")
  399.             IF sz$ = "CONTINUE" THEN
  400.                 CopyFiles = -1
  401.             ELSEIF sz$ = "REACTIVATE" THEN
  402.                 GOTO TOOBIG
  403.             ELSE
  404.                 CopyFiles = 0
  405.             ENDIF
  406.             UIPop 1
  407.             GOTO DONTCOPY
  408.         ENDIF
  409.     NEXT i%
  410.     
  411.     '' We assume that the changes to WIN.INI are negligible,
  412.     '' VIEWER.INI will take 4K, and the Program Manager group file
  413.     '' will take another 4K.
  414.  
  415.     '' BUG FIX!!!
  416.     '' This line apears to cause the dreaded "symtab" bug, which happens
  417.     '' when ReplaceListItem is called with an index that is out of range.
  418.     '' On some machines GetWindowsDir must return a lower-case letter
  419.     '' (or a non-letter) causing this to screw up.
  420.     '' We decided just to comment this out rather than fix it.
  421.     ''   -- mself 1/11/94
  422.     '' ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(8192)
  423.     
  424.     '' Add all of the title files to the copy list
  425.     AddSectionFilesToCopyList "Title Files", SetupSrcDir$, TitleDir$
  426.     
  427.     '' Add all of the modem reg files to the copy list
  428.     AddSectionFilesToCopyList "Modem Reg Files", SetupSrcDir$, ModemRegDir$
  429.     
  430.     '' Add all of the promo files to the copy list
  431.     AddSectionFilesToCopyList "Promo Files", SetupSrcDir$, PromosDir$
  432.     
  433.     '' Get total amount of space required on all drives.
  434.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  435.     
  436.     '' Put up a message if there is not enough space.
  437.     FOR i% = 1 TO 26 STEP 1
  438.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  439.     
  440.             SetSymbolValue "String", TheTitleName$
  441.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  442.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  443.  
  444.             TOOBIG2:
  445.     
  446.             sz$ = UIStartDlg(CUIDLL$, TOOBIG2, "FInfoDlgProc", SYSREQ, "FHelpDlgProc")
  447.             IF sz$ = "CONTINUE" THEN
  448.                 CopyFiles = -1
  449.             ELSEIF sz$ = "REACTIVATE" THEN
  450.                 GOTO TOOBIG2
  451.             ELSE
  452.                 CopyFiles = 0
  453.             ENDIF
  454.             UIPop 1
  455.             GOTO DONTCOPY
  456.         ENDIF
  457.     NEXT i%
  458.     
  459.     '' Add the billboards.
  460.     '' AddBillboards
  461.  
  462.     '' Move the copy gauge out of the way of the billboards.
  463.     '' SetCopyGaugePosition 3,120
  464.  
  465.     '' Copy the files.
  466.     CopyFilesInCopyList
  467.     
  468.     CopyFiles = 1
  469.  
  470. DONTCOPY:
  471.  
  472. END FUNCTION
  473.  
  474.  
  475. '*************************************************************************
  476. '** Purpose:
  477. '**     Puts up a success dialog
  478. '*************************************************************************
  479.  
  480. SUB ShowSuccess STATIC
  481.  
  482.     SUCCESS:
  483.  
  484.     SetSymbolValue "String1", TheTitleName$
  485.     SetSymbolValue "String2", TheTitleName$
  486.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  487.     IF sz$ = "REACTIVATE" THEN
  488.         GOTO SUCCESS
  489.     ENDIF
  490.     UIPop 1
  491.     
  492. END SUB
  493.  
  494.  
  495. '*************************************************************************
  496. '** Purpose:
  497. '**     Appends a file name to the end of a directory path,
  498. '**     inserting a backslash character as needed.
  499. '** Arguments:
  500. '**     szDir$  - full directory path (with optional ending "\")
  501. '**     szFile$ - filename to append to directory
  502. '** Returns:
  503. '**     Resulting fully qualified path name.
  504. '*************************************************************************
  505.  
  506. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  507.     IF szDir$ = "" THEN
  508.         MakePath = szFile$
  509.     ELSEIF szFile$ = "" THEN
  510.         MakePath = szDir$
  511.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  512.         MakePath = szDir$ + szFile$
  513.     ELSE
  514.         MakePath = szDir$ + "\" + szFile$
  515.     ENDIF
  516. END FUNCTION
  517.  
  518.  
  519. '*************************************************************************
  520. '** Purpose:
  521. '**     Upgrades the BTW.INI file from the Deck format to the new format.
  522. '*************************************************************************
  523.  
  524. SUB UpgradeBTWIni STATIC
  525.  
  526.     szIni$ = MakePath(GetWindowsDir(), "BTW.INI")
  527.  
  528.     IF DoesIniSectionExist("WIN.INI", "Books That Work") THEN
  529.  
  530.         szBTWDir$ = GetIniKeyString("WIN.INI", "Books That Work", "BTW Directory")
  531.  
  532.         IF szBTWDir$ <> "" THEN
  533.  
  534.             CreateIniKeyValue szIni$, "General", "BTW Directory", szBTWDir$, cmoOverwrite
  535.  
  536.         ENDIF
  537.  
  538.         RemoveIniSection "WIN.INI", "Books That Work", cmoNone
  539.  
  540.     ENDIF
  541.  
  542.     szBTWDir$ = GetIniKeyString(szIni$, "General", "BTW Directory")
  543.  
  544.     IF szBTWDir$ <> "" THEN
  545.  
  546.         szOldIni$ = MakePath(szBTWDir$, "BTW.INI")
  547.  
  548.         szVer$ = GetIniKeyString(szOldIni$, "Versions", "Deck Program")
  549.     
  550.         IF szVer$ <> "" THEN
  551.  
  552.             CreateIniKeyValue szIni$, "Titles", "DECK", szVer$, cmoOverwrite
  553.  
  554.             CreateIniKeyValue szIni$, "DECK", "Title", "Design & Build Your Deck", cmoOverwrite
  555.             CreateIniKeyValue szIni$, "DECK", "Series", "Home & Yard", cmoOverwrite
  556.             CreateIniKeyValue szIni$, "DECK", "Version", szVer$, cmoOverwrite
  557.             CreateIniKeyValue szIni$, "DECK", "Path", MakePath(szBTWDir$, "DECK"), cmoOverwrite
  558.  
  559.         ENDIF
  560.         
  561.         RemoveFile szOldIni$, cmoForce
  562.  
  563.     ENDIF
  564.  
  565. END SUB
  566.  
  567.  
  568. '*************************************************************************
  569. '** Purpose:
  570. '**     Registers title in BTW.INI
  571. '*************************************************************************
  572.  
  573. SUB ModifyBTWIni STATIC
  574.  
  575.     szIni$ = MakePath(GetWindowsDir(), "BTW.INI")
  576.  
  577.     '' Record the BTW Directory in BTW.INI
  578.     CreateIniKeyValue szIni$, "General", "BTW Directory", BTWDir$, cmoOverwrite
  579.  
  580.     '' Record the title version info in BTW.INI
  581.     CreateIniKeyValue szIni$, "Titles", ShortName$, TitleVersion$, cmoOverwrite
  582.  
  583.     CreateIniKeyValue szIni$, ShortName$, "Title", FullName$, cmoOverwrite
  584.     CreateIniKeyValue szIni$, ShortName$, "Series", SeriesName$, cmoOverwrite
  585.     CreateIniKeyValue szIni$, ShortName$, "Version", TitleVersion$, cmoOverwrite
  586.     CreateIniKeyValue szIni$, ShortName$, "Path", TitleDir$, cmoOverwrite
  587.     CreateIniKeyValue szIni$, ShortName$, "CDPath", CDTitleDir$, cmoOverwrite
  588.     CreateIniKeyValue szIni$, ShortName$, "ProgramPath", ProgramDir$, cmoOverwrite
  589.     CreateIniKeyValue szIni$, ShortName$, "DataPath", DataDir$ + "\", cmoOverwrite
  590.  
  591. END SUB
  592.  
  593.  
  594. '*************************************************************************
  595. '** Purpose:
  596. '**     Registers a font.
  597. '** Arguments:
  598. '**     fontfile$ - font filename
  599. '**     fontname$ - font name.
  600. '*************************************************************************
  601.  
  602. SUB RegisterFont(fontfile$, fontname$) STATIC
  603.  
  604.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  605.  
  606.     IF AddFont(fontfile$, fontname$) = -1 THEN
  607.         j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0)
  608.     ENDIF
  609.  
  610. END SUB
  611.  
  612.  
  613. '*************************************************************************
  614. '** Purpose:
  615. '**     Registers title in VIEWER.INI
  616. '*************************************************************************
  617.  
  618. SUB ModifyViewerIni STATIC
  619.  
  620.     '' Get the VIEWER.INI file
  621.     
  622.     szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI")
  623.  
  624.     '' First register the title file, setting the Name and Path entries. 
  625.     ''
  626.     '' CUSTOMIZATION: If you're installing multiple MVB files, copy the
  627.     '' following two statements for each additional file, substituting
  628.     '' the appropriate long name and MVB filename for the TitleName$
  629.     '' and MVBFileName$ variables.
  630.     
  631.     CreateIniKeyValue szIni$, ShortName$, "Name", TitleName$, cmoOverwrite
  632.     CreateIniKeyValue szIni$, ShortName$, "Path", CDTitleDir$, cmoOverwrite
  633.     
  634.     '' Now we have to register the MVB file in the [FILES] section, so 
  635.     '' Viewer can find files that are not on the path and display a 
  636.     '' special message when a file is not found.
  637.  
  638.     CreateIniKeyValue szIni$, "FILES", "CTL3D.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  639.     CreateIniKeyValue szIni$, "FILES", "MMP.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  640.     CreateIniKeyValue szIni$, "FILES", "MVAPI2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  641.     CreateIniKeyValue szIni$, "FILES", "MVAUDIO.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  642.     CreateIniKeyValue szIni$, "FILES", "MVBMP2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  643.     CreateIniKeyValue szIni$, "FILES", "MVBRKR2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  644.     CreateIniKeyValue szIni$, "FILES", "MVFS2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  645.     CreateIniKeyValue szIni$, "FILES", "MVFTSUI2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  646.     CreateIniKeyValue szIni$, "FILES", "MVMCI2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  647.     CreateIniKeyValue szIni$, "FILES", "MVSRCH2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  648.     CreateIniKeyValue szIni$, "FILES", "MVTITLE2.DLL", SystemDir$ + "," + "Please reinstall " + TheTitleName$ + ".", cmoOverwrite
  649.  
  650.        CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", HowToDir$ + "," + "Please insert the " + TitleName$ + " CD into drive " + CDDrive$ + ".", cmoOverwrite
  651.        CreateIniKeyValue szIni$, "FILES", "CARGUIDE.MVB", HowToDir$ + "," + "Please insert the " + TitleName$ + " CD into drive " + CDDrive$ + ".", cmoOverwrite
  652.        CreateIniKeyValue szIni$, "FILES", "AAFF10.DLL", HowToDir$ + "," + "Please insert the " + TitleName$ + " CD into drive " + CDDrive$ + ".", cmoOverwrite
  653.        CreateIniKeyValue szIni$, "FILES", "CT10.DLL", HowToDir$ + "," + "Please insert the " + TitleName$ + " CD into drive " + CDDrive$ + ".", cmoOverwrite
  654.        CreateIniKeyValue szIni$, "FILES", "TOLLFR10.DLL", HowToDir$ + "," + "Please insert the " + TitleName$ + " CD into drive " + CDDrive$ + ".", cmoOverwrite
  655.  
  656. END SUB
  657.  
  658.  
  659. '*************************************************************************
  660. '** Purpose:
  661. '**     Creates program manager entries for the title
  662. '*************************************************************************
  663.  
  664. SUB ModifyProgramManager STATIC
  665.  
  666.     '' Create the program manager group
  667.  
  668.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  669.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  670.     
  671.     '' Create an entry for the title
  672.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, "MVIEWER2.EXE " + MVBFileName$ + ".MVB", MakePath(TitleDir$, ShortName$ + ".ICO") + ", 0, 0, 0, " + HowToDir$, cmoOverwrite
  673.     
  674.     '' Create an entry for the readme file
  675.     CreateProgmanItem ProgmanGroup$, ProgmanItem$ + " Read Me", MakePath(TitleDir$, "README.WRI"), "", cmoOverwrite
  676.     
  677.     '' Create an entry for the modem registration
  678.     CreateProgmanItem ProgmanGroup$, "Modem Registration", MakePath(ModemRegDir$, "MODEMREG.EXE"), "", cmoOverwrite
  679.     
  680.     '' Create an entry for the promos.
  681.     CreateProgmanItem ProgmanGroup$, "Books That Work Product Sampler", MakePath(PromosDir$, "RUNPROMO.EXE") + " " + MakePath(MakePath(CDTitleDir$, "PROMOS"), "PROMOS.EXE"), "", cmoOverwrite
  682.     
  683.     '' Create an entry for the ads.
  684.     CreateProgmanItem ProgmanGroup$, "Free Toyota CD-ROM Offer", MakePath(PromosDir$, "RUNPROMO.EXE") + " " + MakePath(MakePath(MakePath(HowToDir$, "ADS"), "TOYOTA"), "TOYOTA.EXE"), MakePath(TitleDir$, "TOYOTA.ICO"), cmoOverwrite
  685.     CreateProgmanItem ProgmanGroup$, "Cadillac Presentation", MakePath(PromosDir$, "RUNPROMO.EXE") + " " + MakePath(MakePath(MakePath(HowToDir$, "ADS"), "CADILLAC"), "CADILLAC.EXE"), MakePath(TitleDir$, "CADILLAC.ICO"), cmoOverwrite
  686.  
  687. END SUB
  688.  
  689.  
  690. '*************************************************************************
  691. '** Purpose:
  692. '**     Adds entries to the registration datbase.
  693. '*************************************************************************
  694.  
  695. SUB ModifyRegDatabase STATIC
  696.  
  697.     '' Create entries for Viewer files (.MVB)
  698.     CreateRegKeyValue ".MVB", "MViewer2"
  699.     CreateRegKeyValue "MViewer2", "Viewer Files"
  700.     CreateRegKeyValue "MViewer2\shell\open\command", "MVIEWER2.EXE %1"
  701.  
  702.     '' Create entries for Car & Truck Showroom Search files (.CAT)
  703.     CreateRegKeyValue ".CAT", "CarGuideSearch"
  704.     CreateRegKeyValue "CarGuideSearch", "Car & Truck Showroom Search"
  705.     CreateRegKeyValue "CarGuideSearch\shell\open\command", MakePath (ProgramDir$, "CTAPP.EXE") + " %1"
  706.     CreateRegKeyValue "CarGuideSearch\shell\open\ddeexec", "open(""%1"")"
  707.  
  708. END SUB
  709.  
  710.  
  711. '*************************************************************************
  712. '** Purpose:
  713. '**     Registers custom fonts with Windows.
  714. '*************************************************************************
  715.  
  716. SUB RegisterCustomFonts STATIC
  717.  
  718.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  719.     '' in this routine to register the fonts with the current Windows 
  720.     '' session and to add them to the WIN.INI [Fonts] section. 
  721.     ''
  722.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  723.     '' RegisterFont automatically creates the required .FOT file for 
  724.     '' TrueType fonts.
  725.  
  726.     '' Not for this version....
  727.     '' RegisterFont "arialbd.ttf", "Arial Bold (TrueType)"
  728.     '' RegisterFont "arialbi.ttf", "Arial Bold Italic (TrueType)"
  729.  
  730.     '' Enable TrueType fonts if they aren't already enabled.
  731.     '' We have to restart Windows in this case.
  732.     IF IsTrueTypeEnabled() = 0 THEN
  733.  
  734.         CreateIniKeyValue "WIN.INI", "TrueType", "TTEnable", "1", cmoOverwrite
  735.  
  736.         TTDISABLED:
  737.  
  738.         SetSymbolValue "String1", CapTheTitleName$
  739.  
  740.         sz$ = UIStartDlg(CUIDLL$, TTDISABLED, "FInfoDlgProc", 0, "")
  741.         IF sz$ = "CONTINUE" THEN
  742.             RestartWindows
  743.         ELSEIF sz$ = "REACTIVATE" THEN
  744.             GOTO TTDISABLED
  745.         ENDIF
  746.         UIPop 1
  747.  
  748.     ENDIF
  749.  
  750. END SUB
  751.  
  752.  
  753. '*************************************************************************
  754. '** Purpose:
  755. '**     Ask if the user wants to try modem registration
  756. '*************************************************************************
  757.  
  758. SUB DoModemRegistration STATIC
  759.  
  760.     mReg% = 0
  761.  
  762.     MODEMREG:
  763.  
  764.     sz$ = UIStartDlg(CUIDLL$, MODEMREG, "FInfoDlgProc", 0, "")
  765.     IF sz$ = "CONTINUE" THEN
  766.         mReg% = 1
  767.     ELSEIF sz$ = "REACTIVATE" THEN
  768.         GOTO MODEMREG
  769.     ENDIF
  770.     UIPop 1
  771.     
  772.     IF mReg% = 1 THEN
  773.         Run MakePath(ModemRegDir$, "MODEMREG.EXE") + " -setup"
  774.     ENDIF
  775.  
  776. END SUB
  777.