home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1996 August / DKMMSAMP.iso / tpeurope.mst < prev    next >
Text File  |  1995-10-02  |  17KB  |  580 lines

  1. '**************************************************************************
  2. '*                       TRIVIAL PURSUIT SETUP
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''The following are for installation of the TrueType Font
  11. CONST WM_FONTCHANGE = 29
  12. CONST HWND_BROADCAST = -1
  13.  
  14. ''following were taken from windows.h. &H means they're hex
  15. CONST WS_VISIBLE=&H10000000
  16. CONST WS_BORDER =&H00800000
  17. CONST WS_CLIPCHILDREN =&H02000000
  18. CONST GWL_STYLE =-16
  19. CONST SW_SHOWMAXIMIZED=3
  20.  
  21. CONST DO_CUSTOM = 1
  22.  
  23.  
  24. ''Dialog ID's
  25. CONST ASKQUIT      = 200
  26. CONST DESTPATH     = 300
  27. CONST EXITFAILURE  = 400
  28. CONST EXITQUIT     = 600
  29. CONST EXITSUCCESS  = 700
  30. CONST OPTIONS      = 800
  31. CONST APPHELP      = 900
  32. CONST CUSTINST     = 6200
  33. CONST TOOBIG       = 6300
  34. CONST BADPATH      = 6400
  35.  
  36. ''Bitmap ID
  37. CONST LOGO         = 1
  38.  
  39. ''File Types
  40. CONST APPFILES     = 1
  41. CONST OPTFILES1    = 2
  42. CONST OPTFILES2    = 3
  43.  
  44.  
  45. GLOBAL DEST$        ''Default destination directory.
  46. GLOBAL WINDRIVE$    ''Windows drive letter.
  47. GLOBAL OPT1OPT$     ''Option selection from OptFiles1 option dialog.
  48. GLOBAL OPT2OPT$     ''Option selection from OptFiles2 option dialog.
  49.  
  50. ''CustInst list symbol names
  51. GLOBAL APPNEEDS$    ''Option list costs per drive
  52. GLOBAL OPT1NEEDS$
  53. GLOBAL OPT2NEEDS$
  54. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  55. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  56.  
  57. ''Dialog list symbol names
  58. GLOBAL CHECKSTATES$
  59. GLOBAL STATUSTEXT$
  60. GLOBAL DRIVETEXT$
  61.  
  62. '' The next three declarations are for font installation.
  63.  
  64. DECLARE FUNCTION CreateScalableFontResource  LIB "GDI.EXE" (fHidden%, FOTFile$, TTFFile$, SysDir$) AS INTEGER
  65. DECLARE FUNCTION AddFontResource  LIB "GDI.EXE" (FOTFile$) AS INTEGER
  66. DECLARE FUNCTION SendMessage  LIB "USER.EXE" (hWnd%, Message%, wParam%, lParam&) AS LONG
  67.  
  68. DECLARE FUNCTION ShowWindow  LIB "user.exe" (hWnd%,iShow%) AS INTEGER
  69. DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
  70. DECLARE SUB PlaySound LIB "mscuistf.dll" (arg$)
  71. DECLARE SUB CreateBackground LIB "mscuistf.dll" (arg%)
  72. DECLARE SUB DisplayBitmap LIB "mscuistf.dll" (arg%)
  73. DECLARE SUB CleanUp LIB "mscuistf.dll" 
  74.  
  75. DECLARE SUB AddOptFilesToCopyList (ftype%)
  76. DECLARE SUB RecalcOptFiles (ftype%)
  77. DECLARE SUB RecalcPath
  78. DECLARE SUB SetDriveStatus
  79. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  80.  
  81. INIT:
  82.  
  83.     hWnd%=HwndFrame()
  84.     CreateBackground (hWnd%)
  85.     SWLxx&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
  86.     SWyy%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
  87.     DisplayBitmap (hWnd%)
  88.     
  89.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  90.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  91.  
  92.     SetBitmap CUIDLL$, LOGO
  93.     SetTitle "Trivial Pursuit"
  94.  
  95.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  96.     IF szInf$ = "" THEN
  97.         szInf$ = GetSymbolValue("STF_CWDDIR") + "TPEUROPE.INF"
  98.     END IF
  99.     ReadInfFile szInf$
  100.  
  101.     
  102.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  103.     DEST$ = WINDRIVE$ + ":\PURSUIT"
  104.  
  105.     ''CustInst list symbols
  106.     CHECKSTATES$ = "CheckItemsState"
  107.     STATUSTEXT$  = "StatusItemsText"
  108.     DRIVETEXT$   = "DriveStatusText"
  109.     FOR i% = 1 TO 3 STEP 1
  110.         AddListItem CHECKSTATES$, "ON"
  111.     NEXT i%
  112.     FOR i% = 1 TO 3 STEP 1
  113.         AddListItem STATUSTEXT$, ""
  114.     NEXT i%
  115.     FOR i% = 1 TO 7 STEP 1
  116.         AddListItem DRIVETEXT$, ""
  117.     NEXT i%
  118.     ReplaceListItem DRIVETEXT$, 7, DEST$
  119.  
  120.     ''Disk cost list symbols
  121.     APPNEEDS$   = "AppNeeds"
  122.     OPT1NEEDS$  = "Opt1Needs"
  123.     OPT2NEEDS$  = "Opt2Needs"
  124.     EXTRACOSTS$ = "ExtraCosts"
  125.     BIGLIST$    = "BigList"
  126.     FOR i% = 1 TO 3 STEP 1
  127.         AddListItem BIGLIST$, ""
  128.     NEXT i%
  129.     FOR i% = 1 TO 26 STEP 1
  130.         AddListItem EXTRACOSTS$, "0"
  131.     NEXT i%
  132.  
  133.     WaveFile$ = "PURSUIT.WAV"
  134.     PlaySound(WaveFile$)
  135.  
  136.     ''File Option Variables
  137.     OPT1OPT$ = "1"
  138.     OPT2OPT$ = "1"
  139.  
  140.     RecalcPath
  141.     SetDriveStatus
  142.  
  143. '$IFDEF DEBUG
  144.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  145. '$ENDIF ''DEBUG
  146.  
  147.  
  148.  
  149. CUSTINST:
  150.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  151.  
  152.     IF sz$ = "CONTINUE" THEN
  153.         ''Install only if it will fit.
  154.         FOR i% = 1 TO 3 STEP 1
  155.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  156.                 GOSUB TOOBIG
  157.                 GOTO CUSTINST
  158.             END IF
  159.         NEXT i%
  160.         UIPop 1
  161.         GOTO INSTALL
  162.     ELSEIF sz$ = "PATH" THEN
  163.         GOTO GETPATH
  164. ''    ELSEIF sz$ = "CHK1" THEN
  165. ''        RecalcOptFiles APPFILES
  166. ''        SetDriveStatus
  167. ''        GOTO CUSTINST
  168. ''    ELSEIF sz$ = "CHK2" THEN
  169. ''        RecalcOptFiles OPTFILES1
  170. ''        SetDriveStatus
  171. ''        GOTO CUSTINST
  172. ''    ELSEIF sz$ = "CHK3" THEN
  173. ''        RecalcOptFiles OPTFILES2
  174. ''        SetDriveStatus
  175. ''        GOTO CUSTINST
  176. ''    ELSEIF sz$ = "BTN2" THEN
  177. ''        GOTO OPTFILES1
  178. ''    ELSEIF sz$ = "BTN3" THEN
  179. ''        GOTO OPTFILES2
  180.     ELSEIF sz$ = "REACTIVATE" THEN
  181.         RecalcPath
  182.         SetDriveStatus
  183.         GOTO CUSTINST
  184.     ELSE
  185.         GOSUB ASKQUIT
  186.         GOTO CUSTINST
  187.     END IF
  188.  
  189.  
  190.  
  191. INSTALL:
  192.     ClearCopyList
  193.     AddOptFilesToCopyList APPFILES
  194. ''    AddOptFilesToCopyList OPTFILES1
  195. ''    AddOptFilesToCopyList OPTFILES2
  196.                                        
  197.     ''Add the font to the copy list
  198.     MySrcDir$ = GetSymbolValue("STF_SRCDIR")
  199.     AddSectionFilesToCopyList "Font Install", MySrcDir$, GetWindowsSysDir()
  200.  
  201.     CreateDir DEST$, cmoNone
  202.     CopyFilesInCopyList                   
  203.     ''************************************
  204.     '' Copy the Times New Roman font over
  205.     ''************************************
  206.     ''Get Windows System directory
  207.     SYSDIR$ = GetWindowsSysDir()
  208.     ''Obtain the .FOT file from the .TTF file
  209.     i% = CreateScalableFontResource (0, SYSDIR+"TIMES.FOT", "TIMES.TTF", SYSDIR$)
  210.  
  211.     '' Inform Windows about the new font without rebooting
  212.     i% = AddFontResource (SYSDIR$+"TIMES.FOT")
  213.     
  214.     '' Modify WIN.INI
  215.     FontName$ = String$ (64, 32)
  216.     i% = GetTypeFaceNameFromTTF (SYSDIR$+"times.ttf", FontName$, 64)
  217.     CreateIniKeyValue "WIN.INI", "fonts", FontName$+" (TrueType)", "TIMES.FOT", cmoOverwrite 
  218.     
  219.     '' Inform all the apps on the system about the new font installed
  220.     i% = SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
  221.     
  222.     
  223.         
  224. ''DO_CUSTOM
  225. ''    XXX ( DEST$ )
  226.  
  227. ''    IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  228. ''        ini$ = MakePath(DEST$, "DEMO.INI")
  229. ''        CreateIniKeyValue "WIN.INI", "MSSetup Sample 2", "Option1", OPT1OPT$, cmoNone
  230. ''        CreateIniKeyValue ini$, "Section 1", "Key 1", "Value 1" , cmoNone
  231. ''        CreateIniKeyValue ini$, "Section 2", "Key 2", "Value 2" , cmoNone
  232. ''        CreateIniKeyValue ini$, "Section 3", "Key 3", "Value 3" , cmoNone
  233. ''        ini$ = ""
  234. ''    END IF
  235.  
  236. ''    IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  237.         CreateProgmanGroup "Trivial Pursuit", "", cmoNone
  238.             ShowProgmanGroup  "Trivial Pursuit", 1, cmoNone
  239. ''         CreateProgmanItem "Trivial Pursuit", "dialogs", "dlgedit.exe "+MakePath(DEST$,"dialogs.res"), "", cmoOverwrite
  240. ''        CreateProgmanItem "Trivial Pursuit", "dlgprocs.c", "notepad.exe "+MakePath(DEST$,"dlgprocs.c"), "", cmoOverwrite
  241.            CreateProgmanItem "Trivial Pursuit", "Trivial Pursuit", MakePath(DEST$,"pursuit.exe"), "", cmoOverwrite
  242. ''        CreateProgmanItem "Trivial Pursuit", "dlgprocs.c", "notepad.exe "+MakePath(DEST$,"dlgprocs.c"), "", cmoOverwrite
  243.  
  244. ''    END IF
  245.  
  246.  
  247. QUIT:
  248.     ON ERROR GOTO ERRQUIT
  249.  
  250.     IF ERR = 0 THEN
  251.         dlg% = EXITSUCCESS
  252.         CleanUp
  253.     ELSEIF ERR = STFQUIT THEN
  254.         dlg% = EXITQUIT
  255.         CleanUp
  256.     ELSE
  257.         dlg% = EXITFAILURE
  258.         CleanUp
  259.     END IF
  260. QUITL1:
  261.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  262.     IF sz$ = "REACTIVATE" THEN
  263.         GOTO QUITL1
  264.     END IF
  265.     UIPop 1
  266.  
  267.     END
  268.  
  269. ERRQUIT:
  270.     i% = DoMsgBox("Setup sources were corrupted, call Product Support!", "Fatal Error", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  271.     END
  272.  
  273.  
  274.  
  275. GETPATH:
  276.     SetSymbolValue "EditTextIn", DEST$
  277.     SetSymbolValue "EditFocus", "END"
  278. GETPATHL1:
  279.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  280.  
  281.     IF sz$ = "CONTINUE" THEN
  282.         olddest$ = DEST$
  283.         DEST$ = GetSymbolValue("EditTextOut")
  284.  
  285.         ''Validate new path.
  286.         IF IsDirWritable(DEST$) = 0 THEN
  287.             GOSUB BADPATH
  288.             GOTO GETPATHL1
  289.         END IF
  290.         UIPop 1
  291.  
  292.         ''Truncate display if too long.
  293.         IF LEN(DEST$) > 23 THEN
  294.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  295.         ELSE
  296.             ReplaceListItem DRIVETEXT$, 7, DEST$
  297.         END IF
  298.  
  299.         ''Recalc if path changed.
  300.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  301.             RecalcPath
  302.             SetDriveStatus
  303.         END IF
  304.  
  305.         olddest$ = ""
  306.         GOTO CUSTINST
  307.     ELSEIF sz$ = "REACTIVATE" THEN
  308.         RecalcPath
  309.         SetDriveStatus
  310.         GOTO GETPATHL1
  311.     ELSEIF sz$ = "EXIT" THEN
  312.         GOSUB ASKQUIT
  313.         GOTO GETPATHL1
  314.     ELSE
  315.         UIPop 1
  316.         GOTO CUSTINST
  317.     END IF
  318.  
  319.  
  320.  
  321. ''OPTFILES1:
  322. ''    SetSymbolValue "RadioDefault", OPT1OPT$
  323. ''OPT1L1:
  324. ''    sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  325. ''    newopt$ = GetSymbolValue("ButtonChecked")
  326. ''
  327. ''    IF sz$ = "CONTINUE" THEN
  328. ''        UIPop 1
  329. ''        IF newopt$ <> OPT1OPT$ THEN
  330. ''            OPT1OPT$ = newopt$
  331. ''            RecalcOptFiles OPTFILES1
  332. ''            SetDriveStatus
  333. ''        END IF
  334. ''        newopt$ = ""
  335. ''        GOTO CUSTINST
  336. ''    ELSEIF sz$ = "REACTIVATE" THEN
  337. ''        RecalcPath
  338. ''        SetDriveStatus
  339. ''        GOTO OPT1L1
  340. ''    ELSEIF sz$ = "EXIT" THEN
  341. ''        GOSUB ASKQUIT
  342. ''        GOTO OPT1L1
  343. ''    ELSE
  344. ''        UIPop 1
  345. ''       newopt$ = ""
  346. ''        GOTO CUSTINST
  347. ''    END IF
  348.  
  349.  
  350.  
  351. ''OPTFILES2:
  352. ''    SetSymbolValue "RadioDefault", OPT2OPT$
  353. ''OPT2L1:
  354. ''    sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  355. ''    newopt$ = GetSymbolValue("ButtonChecked")
  356. ''
  357. ''    IF sz$ = "CONTINUE" THEN
  358. ''        UIPop 1
  359. ''        IF newopt$ <> OPT2OPT$ THEN
  360. ''            OPT2OPT$ = newopt$
  361. ''            RecalcOptFiles OPTFILES2
  362. ''           SetDriveStatus
  363. ''        END IF
  364. ''        newopt$ = ""
  365. ''        GOTO CUSTINST
  366. ''    ELSEIF sz$ = "REACTIVATE" THEN
  367. ''        RecalcPath
  368. ''        SetDriveStatus
  369. ''        GOTO OPT2L1
  370. ''    ELSEIF sz$ = "EXIT" THEN
  371. ''        GOSUB ASKQUIT
  372. ''        GOTO OPT2L1
  373. ''    ELSE
  374. ''        UIPop 1
  375. ''        newopt$ = ""
  376. ''        GOTO CUSTINST
  377. ''    END IF
  378.  
  379.  
  380.  
  381. TOOBIG:
  382.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  383.     IF sz$ = "REACTIVATE" THEN
  384.         RecalcPath
  385.         SetDriveStatus
  386.         GOTO TOOBIG
  387.     END IF
  388.     UIPop 1
  389.     RETURN
  390.  
  391.  
  392.  
  393. BADPATH:
  394.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  395.     IF sz$ = "REACTIVATE" THEN
  396.         RecalcPath
  397.         SetDriveStatus
  398.         GOTO BADPATH
  399.     END IF
  400.     UIPop 1
  401.     RETURN
  402.  
  403.  
  404.  
  405. ASKQUIT:
  406.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  407.  
  408.     IF sz$ = "EXIT" THEN
  409.         UIPopAll
  410.         ERROR STFQUIT
  411.         CleanUp
  412.     ELSEIF sz$ = "REACTIVATE" THEN
  413.         GOTO ASKQUIT
  414.     ELSE
  415.         UIPop 1
  416.     END IF
  417.     RETURN
  418.  
  419.  
  420.  
  421. '**
  422. '** Purpose:
  423. '**     Adds the specified option files to the copy list.
  424. '** Arguments:
  425. '**     ftype%  - type of files to add, one of the following:
  426. '**             APPFILES, OPTFILES1, OPTFILES2
  427. '** Returns:
  428. '**     none.
  429. '*************************************************************************
  430. SUB AddOptFilesToCopyList (ftype%) STATIC
  431.  
  432. ''    IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  433.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  434.         IF ftype% = APPFILES THEN
  435.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  436. ''        ELSEIF ftype% = OPTFILES1 THEN
  437. ''            AddSectionKeyFileToCopyList "OptFiles1", OPT1OPT$, SrcDir$, DEST$
  438. ''        ELSEIF ftype% = OPTFILES2 THEN
  439. ''            AddSectionKeyFileToCopyList "OptFiles2", OPT2OPT$, SrcDir$, DEST$
  440.         END IF
  441.         SrcDir$ = ""
  442. ''    END IF
  443. END SUB
  444.  
  445.  
  446. '**
  447. '** Purpose:
  448. '**     Recalculates disk space for the given option files and sets
  449. '**     the status info symbol "StatusItemsText".
  450. '** Arguments:
  451. '**     ftype% - type of files to add, one of the following:
  452. '**             APPFILES, OPTFILES1, OPTFILES2
  453. '** Returns:
  454. '**     none.
  455. '*************************************************************************
  456. SUB RecalcOptFiles (ftype%) STATIC
  457.     CursorSave% = ShowWaitCursor()
  458.     ClearCopyList
  459.     AddOptFilesToCopyList ftype%
  460.  
  461.     fExtra% = 0
  462.     IF ftype% = APPFILES THEN
  463.         ListSym$ = APPNEEDS$
  464. ''        IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  465.             ''Add extra cost to Windows drive for ini/progman, etc.
  466.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  467.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  468.             fExtra% = 1
  469. ''        END IF
  470.     ELSEIF ftype% = OPTFILES1 THEN
  471.         ListSym$ = OPT1NEEDS$
  472.     ELSEIF ftype% = OPTFILES2 THEN
  473.         ListSym$ = OPT2NEEDS$
  474.     END IF
  475.  
  476.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  477.  
  478.     cost& = 0
  479.     FOR i% = 1 TO 26 STEP 1
  480.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  481.     NEXT i%
  482.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  483.  
  484.     IF StillNeed& > 0 THEN
  485.         ReplaceListItem BIGLIST$, ftype%, "YES"
  486.     ELSE
  487.         ReplaceListItem BIGLIST$, ftype%, ""
  488.     END IF
  489.  
  490.     IF fExtra% THEN
  491.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  492.     END IF
  493.     RestoreCursor CursorSave%
  494.     ListSym$ = ""
  495. END SUB
  496.  
  497.  
  498. '**
  499. '** Purpose:
  500. '**     Recalculates disk space and sets option status info according
  501. '**     to the current destination path.
  502. '** Arguments:
  503. '**     none.
  504. '** Returns:
  505. '**     none.
  506. '*************************************************************************
  507. SUB RecalcPath STATIC
  508.  
  509.     CursorSave% = ShowWaitCursor()
  510.  
  511.     RecalcOptFiles APPFILES
  512. ''    RecalcOptFiles OPTFILES1
  513. ''    RecalcOptFiles OPTFILES2
  514.  
  515.     RestoreCursor CursorSave%
  516. END SUB
  517.  
  518.  
  519. '**
  520. '** Purpose:
  521. '**     Sets drive status info according to latest disk space calcs.
  522. '** Arguments:
  523. '**     none.
  524. '** Returns:
  525. '**     none.
  526. '*************************************************************************
  527. SUB SetDriveStatus STATIC
  528.  
  529.     drive$ = MID$(DEST$, 1, 1)
  530.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  531.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) ''+ VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  532.     free& = GetFreeSpaceForDrive(drive$)
  533.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  534.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  535.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  536.  
  537.     IF drive$ = WINDRIVE$ THEN
  538.         ReplaceListItem DRIVETEXT$, 4, ""
  539.         ReplaceListItem DRIVETEXT$, 5, ""
  540.         ReplaceListItem DRIVETEXT$, 6, ""
  541.     ELSE
  542.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  543.         cost& = VAL(GetListItem(APPNEEDS$, ndrive%))'' + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  544.         IF cost& = 0 THEN
  545.             ReplaceListItem DRIVETEXT$, 4, ""
  546.             ReplaceListItem DRIVETEXT$, 5, ""
  547.             ReplaceListItem DRIVETEXT$, 6, ""
  548.         ELSE
  549.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  550.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  551.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  552.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  553.         END IF
  554.     END IF
  555. END SUB
  556.  
  557.  
  558. '**
  559. '** Purpose:
  560. '**     Appends a file name to the end of a directory path,
  561. '**     inserting a backslash character as needed.
  562. '** Arguments:
  563. '**     szDir$  - full directory path (with optional ending "\")
  564. '**     szFile$ - filename to append to directory
  565. '** Returns:
  566. '**     Resulting fully qualified path name.
  567. '*************************************************************************
  568. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  569.     IF szDir$ = "" THEN
  570.         MakePath = szFile$
  571.     ELSEIF szFile$ = "" THEN
  572.         MakePath = szDir$
  573.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  574.         MakePath = szDir$ + szFile$
  575.     ELSE
  576.         MakePath = szDir$ + "\" + szFile$
  577.     END IF
  578. END FUNCTION
  579.  
  580.