home *** CD-ROM | disk | FTP | other *** search
/ Software Collection (I) / TOOLS.iso / b18 / 2.img / VBSQL.MST < prev    next >
Encoding:
Text File  |  1992-09-15  |  19.4 KB  |  631 lines

  1. ''***************************************************************
  2. ''* This is the setup script for the Visual Basic Library for SQL Server
  3. ''*
  4. ''* Modification History
  5. ''*
  6. ''* Trish Millines-9/16/92- Upgraded to version 2.0 of Setup
  7. ''***************************************************************
  8.  
  9. '$DEFINE DEBUG  ''Define for script development/debugging
  10.  
  11. '$INCLUDE 'setupapi.inc'
  12. '$INCLUDE 'msdetect.inc'
  13. '$INCLUDE 'mscpydis.inc'    ''System
  14.  
  15. ''Dialog ID's
  16. CONST WELCOME       = 100
  17. CONST ASKQUIT       = 200
  18. CONST DESTPATH      = 300
  19. CONST EXITFAILURE   = 400
  20. CONST EXITQUIT      = 600
  21. CONST EXITSUCCESS   = 700
  22. CONST OPTIONS       = 800
  23.  
  24. CONST CUSTHELP        = 1000
  25. CONST WELCOMEHELP   = 1200
  26. CONST PATHHELP        = 1100
  27. CONST NOSELECTION   = 1300
  28.  
  29. CONST CUSTINST        = 6200
  30. CONST TOOBIG        = 6300
  31. CONST BADPATH       = 6400
  32. CONST BILLBOARD     = 4545
  33.  
  34. ''Bitmap ID
  35. CONST LOGO = 1
  36.  
  37. ''File Types
  38. CONST LIBFILES       = 1      ''Library files
  39. CONST BROWSEFILES  = 2      ''Browse Example files
  40. CONST TEXTFILES    = 3      ''Text Example files
  41. CONST IMAGEFILES   = 4      ''Image Example files
  42. CONST CURSORFILES  = 5      ''Cursor Example files
  43. CONST QUERYFILES   = 6      ''Query Example files
  44. CONST PROCFILES    = 7      ''Shared Procedure files
  45. CONST INCLUDEFILE  = 8      ''Include file
  46.  
  47. GLOBAL DEST$        ''Default destination directory.
  48. GLOBAL WINDRIVE$    ''Windows drive letter.
  49. GLOBAL WINDOWSDIR$  ''Windows directory
  50.  
  51. ''CustInst list symbol names
  52. GLOBAL LIBNEEDS$      ''Library needs
  53. GLOBAL BROWSENEEDS$   ''Browse Example needs
  54. GLOBAL IMAGENEEDS$    ''Image Example needs
  55. GLOBAL TEXTNEEDS$     ''Text Example needs
  56. GLOBAL CURSORNEEDS$   ''Cursor Example needs
  57. GLOBAL QUERYNEEDS$    ''Query Example needs
  58. GLOBAL PROCNEEDS$     ''Shared procedures needs
  59. GLOBAL EXTRACOSTS$    ''List of extra costs to add per drive
  60. GLOBAL BIGLIST$       ''List of option files cost calc results (boolean)
  61.  
  62. ''Dialog list symbol names
  63. GLOBAL CHECKSTATES$
  64. GLOBAL STATUSTEXT$
  65. GLOBAL DRIVETEXT$
  66.  
  67. DECLARE SUB AddOptFilesToCopyList (ftype%)
  68. DECLARE SUB RecalcOptFiles (ftype%)
  69. DECLARE SUB RecalcPath
  70. DECLARE SUB SetDriveStatus
  71. DECLARE SUB SetProcStatus
  72. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  73. DECLARE FUNCTION BitmapCntrlInit LIB "mscuistf.dll" as INTEGER
  74. DECLARE FUNCTION NeedProcFiles () AS INTEGER
  75.  
  76. INIT:
  77.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  78.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  79.     SQLTOOLS$ = "SQL Server Tools"
  80.     SetBitmap CUIDLL$, LOGO
  81.     SetTitle "Microsoft Visual Basic for SQL Server Tools Setup"
  82.  
  83.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  84.     IF szInf$ = "" THEN
  85.     szInf$ = GetSymbolValue("STF_CWDDIR") + "VBSQL.INF"
  86.     END IF
  87.     ReadInfFile szInf$
  88.  
  89.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  90.     WINDOWSDIR$ = GetWindowsDir()
  91.     DEST$ = WINDRIVE$ + ":\sql"
  92.  
  93.     ''CustInst list symbols
  94.     CHECKSTATES$ = "CheckItemsState"
  95.     STATUSTEXT$  = "StatusItemsText"
  96.     DRIVETEXT$     = "DriveStatusText"
  97.     FOR i% = 1 to 7 STEP 1
  98.        AddListItem CHECKSTATES$, "ON"
  99.     NEXT i%
  100.     FOR i% = 1 to 7 STEP 1
  101.         AddListItem STATUSTEXT$, ""
  102.     NEXT i%
  103.     FOR i% = 1 to 7 STEP 1
  104.         AddListItem DRIVETEXT$, ""
  105.     NEXT i%
  106.     ReplaceListItem DRIVETEXT$, 7, DEST$
  107.  
  108.     ''Disk cost list symbols
  109.     LIBNEEDS$       = "LibraryNeeds"
  110.     BROWSENEEDS$   = "BrowseNeeds"
  111.     IMAGENEEDS$    = "ImageNeeds"
  112.     TEXTNEEDS$       = "TextNeeds"
  113.     CURSORNEEDS$   = "CursorNeeds"
  114.     QUERYNEEDS$    = "QueryNeeds"
  115.     PROCNEEDS$       = "ProcNeeds"
  116.     EXTRACOSTS$ = "ExtraCosts"
  117.     BIGLIST$    = "BigList"
  118.     FOR i% = 1 to 7 STEP 1
  119.         AddListItem BIGLIST$, ""
  120.     NEXT i%
  121.     FOR i% = 1 TO 26 STEP 1
  122.         AddListItem EXTRACOSTS$, "0"
  123.     NEXT i%
  124.  
  125.     RecalcPath
  126.     SetDriveStatus
  127.  
  128. WELCOME:
  129.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", WELCOMEHELP, HELPPROC$)
  130.     IF sz$ = "CONTINUE" THEN
  131.         UIPop 1
  132. WELCOMEL1:
  133.         IF InitSystem(1, "", 0) = 0 THEN
  134.             GOSUB ASKQUIT
  135.             GOTO WELCOMEL1
  136.         END IF
  137.     ELSE
  138.         GOSUB ASKQUIT
  139.         GOTO WELCOME
  140.     END IF
  141.  
  142. GETPATH:
  143.     SetSymbolValue "EditTextIn", DEST$
  144.     SetSymbolValue "EditFocus", "END"
  145. GETPATHL1:
  146.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", PATHHELP, HELPPROC$)
  147.     DEST$ = GetSymbolValue("EditTextOut")
  148.  
  149.     IF sz$ = "CONTINUE" THEN
  150.         IF IsDirWritable(DEST$) = 0 THEN
  151.             GOSUB BADPATH
  152.             GOTO GETPATHL1
  153.     END IF
  154.         UIPop 1
  155.     ELSEIF sz$ = "REACTIVATE" THEN
  156.         GOTO GETPATHL1
  157.     ELSE
  158.         GOSUB ASKQUIT
  159.         GOTO GETPATH
  160.     END IF
  161.  
  162. CUSTINST:
  163.     ReplaceListItem DRIVETEXT$, 7, DEST$
  164.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", CUSTHELP, HELPPROC$)
  165.  
  166.     IF sz$ = "CONTINUE" THEN
  167.         ''Install only if it will fit.
  168.     FOR i% = 1 to 7 STEP 1
  169.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  170.                 GOSUB TOOBIG
  171.                 GOTO CUSTINST
  172.             END IF
  173.         NEXT i%
  174.         UIPop 1
  175.     GOTO CHECKSELECT
  176.     ELSEIF sz$ = "PATH" THEN
  177.     GOTO GETPATH
  178.     ELSEIF sz$ = "REACTIVATE" THEN
  179.         RecalcPath
  180.         SetDriveStatus
  181.         GOTO CUSTINST
  182.     ELSEIF sz$ = "CHK1" THEN
  183.     RecalcOptFiles LIBFILES
  184.     SetDriveStatus
  185.         GOTO CUSTINST
  186.     ELSEIF sz$ = "CHK2" THEN
  187.     RecalcOptFiles BROWSEFILES
  188.     SetProcStatus
  189.         SetDriveStatus
  190.         GOTO CUSTINST
  191.     ELSEIF sz$ = "CHK3" THEN
  192.     RecalcOptFiles TEXTFILES
  193.     SetProcStatus
  194.         SetDriveStatus
  195.         GOTO CUSTINST
  196.     ELSEIF sz$ = "CHK4" THEN
  197.     RecalcOptFiles IMAGEFILES
  198.     SetProcStatus
  199.         SetDriveStatus
  200.         GOTO CUSTINST
  201.     ELSEIF sz$ = "CHK5" THEN
  202.     RecalcOptFiles CURSORFILES
  203.     SetProcStatus
  204.         SetDriveStatus
  205.         GOTO CUSTINST
  206.     ELSEIF sz$ = "CHK6" THEN
  207.     RecalcOptFiles QUERYFILES
  208.     SetProcStatus
  209.         SetDriveStatus
  210.         GOTO CUSTINST
  211.     ELSE
  212.         GOSUB ASKQUIT
  213.         GOTO CUSTINST
  214.     END IF
  215.  
  216. CHECKSELECT:
  217.     noselect% = 0
  218.     IF GetListItem(CHECKSTATES$, LIBFILES) = "OFF"  and NeedProcFiles() = 0 THEN
  219.     noselect% = 1
  220.     END IF
  221.  
  222.     IF noselect% = 1 then     'If they didn't select anything
  223.        sz$ = UIStartDlg(CUIDLL$, NOSELECTION, "FInfo0DlgProc", 0, "")
  224.        UIPop 1
  225.        GOTO CUSTINST
  226.     END IF
  227.  
  228. CREATEDEST:
  229.  
  230.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  231.     CreateDir DEST$, cmoVital        ''Create the destination directory
  232.     i% = SetSizeCheckMode(scmOff)
  233.     DESTSAVE$ = DEST$            ''Save dest directory as the root path
  234.     SetCopyGaugePosition 100, 100
  235.  
  236.  COPYLIBFILES:
  237.     ClearCopyList                 ''Clear the copy list
  238.     IF GetListItem(CHECKSTATES$, LIBFILES) = "ON" THEN
  239.     DEST$ = DESTSAVE$ + "\bin"
  240.     CreateDir DEST$, cmoVital         ''Create the bin directory
  241.     AddSectionFilesToCopyList "LibFiles", SrcDir$, DEST$
  242.     CopyFilesInCopyList              ''Copy the files
  243.     ClearCopyList                  ''Clear the copy list
  244.  
  245.     DEST$ = DESTSAVE$ + "\dblib"
  246.     CreateDir DEST$, cmoVital        ''Create the dblib directory
  247.     DEST$ = DEST$ + "\include"
  248.     CreateDir DEST$, cmoVital         ''Create the include directory
  249.     AddSectionFilesToCopyList "IncludeFile", SrcDir$, DEST$
  250.     CopyFilesInCopyList              ''Copy the files
  251.     ClearCopyList                  ''Clear the copy list
  252.     END IF
  253.  
  254. CHECKSAMPLES:
  255.     If NeedProcFiles() = 1 THEN          ''See if installing any examples
  256.     DEST$ = DESTSAVE$ + "\dblib"
  257.     CreateDir DEST$, cmoVital        ''Create the dblib directory
  258.     DEST$ = DEST$ + "\vsamples"
  259.     CreateDir DEST$, cmoVital         ''Create the vsamples directory
  260.     SAMPDEST$ = DEST$
  261.     DEST$ = SAMPDEST$ + "\gencode"
  262.     CreateDir DEST$, cmoVital         ''Create the destination directory
  263.     AddSectionFilesToCopyList "ProcedureFiles", SrcDir$, DEST$
  264.     CopyFilesInCopyList              ''Copy the files
  265.     ClearCopyList                  ''Clear the copy list
  266.     END IF
  267.  
  268. COPYBROWSEFILES:
  269.     IF GetListItem(CHECKSTATES$, BROWSEFILES) = "ON" THEN
  270.     DEST$ = SAMPDEST$ + "\browse"
  271.     CreateDir DEST$, cmoVital         ''Create the destination directory
  272.     AddSectionFilesToCopyList "BrowseFiles", SrcDir$, DEST$
  273.     CopyFilesInCopyList              ''Copy the files
  274.     ClearCopyList                  ''Clear the copy list
  275.     END IF
  276.  
  277. COPYTEXTFILES:
  278.     IF GetListItem(CHECKSTATES$, TEXTFILES) = "ON" THEN
  279.     DEST$ = SAMPDEST$ + "\text"
  280.     CreateDir DEST$, cmoVital         ''Create the destination directory
  281.     AddSectionFilesToCopyList "TextFiles", SrcDir$, DEST$
  282.     CopyFilesInCopyList              ''Copy the files
  283.     ClearCopyList                  ''Clear the copy list
  284.     END IF
  285.  
  286. COPYIMAGEFILES:
  287.     IF GetListItem(CHECKSTATES$, IMAGEFILES) = "ON" THEN
  288.     DEST$ = SAMPDEST$ + "\image"
  289.     CreateDir DEST$, cmoVital         ''Create the destination directory
  290.     AddSectionFilesToCopyList "ImageFiles", SrcDir$, DEST$
  291.     CopyFilesInCopyList              ''Copy the files
  292.     ClearCopyList                  ''Clear the copy list
  293.     END IF
  294.  
  295. COPYCURSORFILES:
  296.     IF GetListItem(CHECKSTATES$, CURSORFILES) = "ON" THEN
  297.     DEST$ = SAMPDEST$ + "\cursors"
  298.     CreateDir DEST$, cmoVital         ''Create the destination directory
  299.     AddSectionFilesToCopyList "CursorFiles", SrcDir$, DEST$
  300.     CopyFilesInCopyList              ''Copy the files
  301.     ClearCopyList                  ''Clear the copy list
  302.     END IF
  303.  
  304. COPYQUERYFILES:
  305.     IF GetListItem(CHECKSTATES$, QUERYFILES) = "ON" THEN
  306.     DEST$ = SAMPDEST$ + "\vbquery"
  307.     CreateDir DEST$, cmoVital         ''Create the destination directory
  308.     AddSectionFilesToCopyList "QueryFiles", SrcDir$, DEST$
  309.     CopyFilesInCopyList              ''Copy the files
  310.     ClearCopyList                  ''Clear the copy list
  311.     END IF
  312.  
  313.  
  314. QUIT:
  315.     ON ERROR GOTO ERRQUIT
  316.  
  317.     IF ERR = 0 THEN
  318.         dlg% = EXITSUCCESS
  319.     ELSEIF ERR = STFQUIT THEN
  320.         dlg% = EXITQUIT
  321.     ELSE
  322.         dlg% = EXITFAILURE
  323.     END IF
  324. QUITL1:
  325.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  326.     IF sz$ = "REACTIVATE" THEN
  327.         GOTO QUITL1
  328.     END IF
  329.     UIPop 1
  330.  
  331.     END
  332.  
  333. ERRQUIT:
  334.     i% = DoMsgBox("Setup sources were corrupted, call product support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  335.     END
  336.  
  337. TOOBIG:
  338.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  339.     IF sz$ = "REACTIVATE" THEN
  340.         RecalcPath
  341.         SetDriveStatus
  342.         GOTO TOOBIG
  343.     END IF
  344.     UIPop 1
  345.     RETURN
  346.  
  347. BADPATH:
  348.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  349.     IF sz$ = "REACTIVATE" THEN
  350.         GOTO BADPATH
  351.     END IF
  352.     UIPop 1
  353.     RETURN
  354.  
  355.  
  356.  
  357. ASKQUIT:
  358.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  359.  
  360.     IF sz$ = "EXIT" THEN
  361.         UIPopAll
  362.         ERROR STFQUIT
  363.     ELSEIF sz$ = "REACTIVATE" THEN
  364.         GOTO ASKQUIT
  365.     ELSE
  366.         UIPop 1
  367.     END IF
  368.     RETURN
  369.  
  370. '**
  371. '** Purpose:
  372. '**     Adds the specified option files to the copy list.
  373. '** Arguments:
  374. '**     ftype%  - type of files to add, one of the following:
  375. '**             ADMINFILES, OBJFILES, BASEFILES
  376. '** Returns:
  377. '**     none.
  378. '*************************************************************************
  379. SUB AddOptFilesToCopyList (ftype%) STATIC
  380.  
  381.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  382.  
  383.     IF    ftype% = PROCFILES THEN
  384.     AddSectionFilesToCopyList "ProcedureFiles", SrcDir$, DEST$
  385.     ELSEIF  GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  386.     IF ftype% = LIBFILES THEN
  387.         AddSectionFilesToCopyList "LibFiles", SrcDir$, DEST$
  388.         AddSectionFilesToCopyList "IncludeFile", SrcDir$, DEST$
  389.     ELSEIF ftype% = BROWSEFILES THEN
  390.         AddSectionFilesToCopyList "BrowseFiles", SrcDir$, DEST$
  391.     ELSEIF ftype% = IMAGEFILES THEN
  392.         AddSectionFilesToCopyList "ImageFiles", SrcDir$, DEST$
  393.     ELSEIF ftype% = TEXTFILES THEN
  394.         AddSectionFilesToCopyList "TextFiles", SrcDir$, DEST$
  395.     ELSEIF ftype% = CURSORFILES THEN
  396.         AddSectionFilesToCopyList "CursorFiles", SrcDir$, DEST$
  397.     ELSEIF ftype% = QUERYFILES THEN
  398.         AddSectionFilesToCopyList "QueryFiles", SrcDir$, DEST$
  399.     END IF
  400.     SrcDir$ = ""
  401.     END IF
  402. END SUB
  403.  
  404. '**
  405. '** Purpose:
  406. '**     Recalculates disk space for the given option files and sets
  407. '**     the status info symbol "StatusItemsText".
  408. '** Arguments:
  409. '**     ftype% - type of files to add, one of the following:
  410. '**             LIBFILES, BROWSEFILES, IMAGEFILES, TEXTFILES, CURSORFILES,
  411. '**             QUERYFILES, PROCFILES
  412. '** Returns:
  413. '**     none.
  414. '*************************************************************************
  415. SUB RecalcOptFiles (ftype%) STATIC
  416.     CursorSave% = ShowWaitCursor()
  417.     ClearCopyList
  418.     AddOptFilesToCopyList ftype%
  419.     DESTSAVE$ = DEST$
  420.  
  421.     fExtra% = 0
  422.     IF ftype% = LIBFILES THEN
  423.     ListSym$ = LIBNEEDS$
  424.     IF GetListItem(CHECKSTATES$, LIBFILES) = "ON" THEN
  425.             ''Add extra cost to Windows drive for ini/progman, etc.
  426.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  427.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  428.             fExtra% = 1
  429.     END IF
  430.     ELSEIF ftype% = BROWSEFILES THEN
  431.     ListSym$ = BROWSENEEDS$
  432.     DEST$ = DEST$ + "\dblib\vsamples\browse"
  433.     IF GetListItem(CHECKSTATES$, BROWSEFILES) = "ON" THEN
  434.         ''Add extra cost to Windows drive for ini/progman, etc.
  435.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  436.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  437.             fExtra% = 1
  438.     END IF
  439.     ELSEIF ftype% = IMAGEFILES THEN
  440.     ListSym$ = IMAGENEEDS$
  441.     IF GetListItem(CHECKSTATES$, IMAGEFILES) = "ON" THEN
  442.         ''Add extra cost to Windows drive for ini/progman, etc.
  443.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  444.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  445.             fExtra% = 1
  446.     END IF
  447.     ELSEIF ftype% = TEXTFILES THEN
  448.     ListSym$ = TEXTNEEDS$
  449.     IF GetListItem(CHECKSTATES$, TEXTFILES) = "ON" THEN
  450.         ''Add extra cost to Windows drive for ini/progman, etc.
  451.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  452.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  453.             fExtra% = 1
  454.     END IF
  455.     ELSEIF ftype% = CURSORFILES THEN
  456.     ListSym$ = CURSORNEEDS$
  457.     IF GetListItem(CHECKSTATES$, CURSORFILES) = "ON" THEN
  458.         ''Add extra cost to Windows drive for ini/progman, etc.
  459.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  460.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  461.             fExtra% = 1
  462.     END IF
  463.     ELSEIF ftype% = QUERYFILES THEN
  464.     ListSym$ = QUERYNEEDS$
  465.     IF GetListItem(CHECKSTATES$, QUERYFILES) = "ON" THEN
  466.         ''Add extra cost to Windows drive for ini/progman, etc.
  467.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  468.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  469.             fExtra% = 1
  470.     END IF
  471.     ELSEIF ftype% = PROCFILES THEN
  472.     ListSym$ = PROCNEEDS$
  473.     END IF
  474.  
  475.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  476.  
  477.     cost& = 0
  478.     FOR i% = 1 TO 26 STEP 1
  479.     cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  480.     NEXT i%
  481.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  482.  
  483.     IF StillNeed& > 0 THEN
  484.         ReplaceListItem BIGLIST$, ftype%, "YES"
  485.     ELSE
  486.  
  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.     DEST$ = DESTSAVE$
  496. END SUB
  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 LIBFILES
  512.     RecalcOptFiles PROCFILES
  513.     RecalcOptFiles IMAGEFILES
  514.     RecalcOptFiles TEXTFILES
  515.     RecalcOptFiles CURSORFILES
  516.     RecalcOptFiles QUERYFILES
  517.     RecalcOptFiles BROWSEFILES
  518.  
  519.     RestoreCursor CursorSave%
  520. END SUB
  521.  
  522.  
  523. '**
  524. '** Purpose:
  525. '**     Sets drive status info according to latest disk space calcs.
  526. '** Arguments:
  527. '**     none.
  528. '** Returns:
  529. '**     none.
  530. '*************************************************************************
  531. SUB SetDriveStatus STATIC
  532.  
  533.     drive$ = MID$(DEST$, 1, 1)
  534.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  535.     cost& = VAL(GetListItem(LIBNEEDS$, ndrive%)) + VAL(GetListItem(BROWSENEEDS$, ndrive%)) + VAL(GetListItem(IMAGENEEDS$, ndrive%))
  536.     cost& = cost& + VAL(GetListItem(TEXTNEEDS$, ndrive%)) + VAL(GetListItem(CURSORNEEDS$, ndrive%))
  537.     cost& = cost& + VAL(GetListItem(QUERYNEEDS$, ndrive%)) + VAL(GetListItem(PROCNEEDS$, ndrive%))
  538.     free& = GetFreeSpaceForDrive(drive$)
  539.  
  540.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  541.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  542.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  543.  
  544.     IF drive$ = WINDRIVE$ THEN
  545.         ReplaceListItem DRIVETEXT$, 4, ""
  546.         ReplaceListItem DRIVETEXT$, 5, ""
  547.         ReplaceListItem DRIVETEXT$, 6, ""
  548.     ELSE
  549.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  550.     cost& = VAL(GetListItem(LIBNEEDS$, ndrive%)) + VAL(GetListItem(BROWSENEEDS$, ndrive%)) + VAL(GetListItem(IMAGENEEDS$, ndrive%))
  551.     cost& = cost& + VAL(GetListItem(TEXTNEEDS$, ndrive%)) + VAL(GetListItem(CURSORNEEDS$, ndrive%))
  552.     cost& = cost& + VAL(GetListItem(QUERYNEEDS$, ndrive%)) + VAL(GetListItem(PROCNEEDS$, ndrive%))
  553.         IF cost& = 0 THEN
  554.             ReplaceListItem DRIVETEXT$, 4, ""
  555.             ReplaceListItem DRIVETEXT$, 5, ""
  556.             ReplaceListItem DRIVETEXT$, 6, ""
  557.         ELSE
  558.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  559.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  560.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  561.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  562.         END IF
  563.     END IF
  564. END SUB
  565.  
  566. '**
  567. '** Purpose:
  568. '**     Appends a file name to the end of a directory path,
  569. '**     inserting a backslash character as needed.
  570. '** Arguments:
  571. '**     szDir$  - full directory path (with optional ending "\")
  572. '**     szFile$ - filename to append to directory
  573. '** Returns:
  574. '**     Resulting fully qualified path name.
  575. '*************************************************************************
  576. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  577.     IF szDir$ = "" THEN
  578.         MakePath = szFile$
  579.     ELSEIF szFile$ = "" THEN
  580.         MakePath = szDir$
  581.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  582.         MakePath = szDir$ + szFile$
  583.     ELSE
  584.         MakePath = szDir$ + "\" + szFile$
  585.     END IF
  586. END FUNCTION
  587.  
  588. '**
  589. '** Purpose:
  590. '**     Checks to see if we need to consider the common procedure files
  591. '**     for either copying or checking disk space.
  592. '**
  593. '** Arguments: NONE
  594. '** Returns:
  595. '**     1 if need it or 0 if don't.  Based on if any of the
  596. '**     example files were picked
  597. '*************************************************************************
  598. FUNCTION NeedProcFiles () STATIC AS INTEGER
  599.     NeedProcFiles =  0
  600.     IF GetListItem(CHECKSTATES$, BROWSEFILES) = "ON" THEN
  601.        NeedProcFiles =    1
  602.     ELSEIF GetListItem(CHECKSTATES$, TEXTFILES) = "ON"    THEN
  603.        NeedProcFiles =    1
  604.     ELSEIF GetListItem(CHECKSTATES$, IMAGEFILES) = "ON" THEN
  605.        NeedProcFiles =    1
  606.     ELSEIF GetListItem(CHECKSTATES$, CURSORFILES) = "ON" THEN
  607.        NeedProcFiles =    1
  608.     ELSEIF GetListItem(CHECKSTATES$, QUERYFILES) = "ON" THEN
  609.        NeedProcFiles =    1
  610.     END IF
  611. END FUNCTION
  612.  
  613. '**
  614. '** Purpose:
  615. '**     Changes the status of the Procedure files to ON or OFF
  616. '**     based on if any of the examples were chosen.
  617. '**
  618. '** Arguments: NONE
  619. '** Returns: NONE
  620. '*************************************************************************
  621. SUB SetProcStatus STATIC
  622.  
  623.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  624.     IF NeedProcFiles () = 0 THEN
  625.     ReplaceListItem STATUSTEXT$, 7, "0 K"
  626.     ReplaceListItem PROCNEEDS$, ndrive%, "0"
  627.     ELSE
  628.     RecalcOptFiles PROCFILES
  629.     END IF
  630. END SUB
  631.