home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 December / CHIP_CD_1996_12_PL.iso / software / trial / netviz / netviz.ms_ / netviz.ms
Encoding:
Text File  |  1996-06-05  |  28.8 KB  |  957 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 2
  3. '**************************************************************************
  4.  
  5. ''$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. DECLARE SUB    InitializeMyWindow LIB "mscuistf.dll" (hMainWind% )
  11. ''ACS6-5-95 Stolen from MS Test winapi16.inc
  12. DECLARE FUNCTION WinExec LIB "Kernel" (sz$, w%) As INTEGER
  13. DECLARE FUNCTION FindWindow LIB "User" (sz$, sz$) As INTEGER
  14.  
  15. ''Dialog ID's
  16. CONST ASKQUIT         =  200
  17. CONST DESTPATH        =  300
  18. CONST EXITFAILURE     =  400
  19. CONST EXITQUIT        =  600
  20. CONST EXITSUCCESS     =  700
  21. CONST FILE_OVERWRITE  =  800
  22. CONST FILE_FORMAT     =  900
  23. CONST APPHELP         = 1000
  24. CONST MULTILIST       = 5200
  25. CONST CUSTINST        = 6200
  26. CONST TOOBIG          = 6300
  27. CONST BADPATH         = 6400
  28. CONST SAMPLE          = 6500
  29. CONST EXPANDINGFILES  = 6550
  30. CONST WINTOOBIG       = 6600
  31.  
  32. ''Message Box Constants
  33. CONST IDYES           =  6
  34. CONST MB_ICONQUESTION = 32
  35. CONST MB_YESNO        =  4
  36.  
  37. ''Bitmap ID
  38. CONST LOGO         = 1
  39.  
  40. ''File Types
  41. CONST  APPFILES     = 1
  42. CONST  HELPFILES    = 2
  43. CONST  MOVIE        = 3
  44. ''CONST  GRAPHICS     = 4
  45. ''CONST  FILTERS      = 5
  46.  
  47. CONST  ZIPAPPFILES     = 11
  48. CONST  ZIPHELPFILES    = 12
  49. CONST  ZIPMOVIE        = 13
  50.  
  51. CONST  TOTAL_STATE  = 3
  52.  
  53. GLOBAL DEST$        ''Default destination directory.
  54. GLOBAL WINDRIVE$    ''Windows drive letter.
  55. GLOBAL OPTCUR$      ''Option selection from option dialog.
  56. GLOBAL FILTERLISTS$
  57.  
  58.  
  59. ''CustInst list symbol names
  60. GLOBAL APPNEEDS$    ''Option list costs per drive
  61. GLOBAL GRAPHICSNEEDS$
  62. GLOBAL HELPNEEDS$
  63. GLOBAL FILTERNEEDS$
  64. GLOBAL MOVIENEEDS$
  65.  
  66. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  67. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  68.  
  69. ''Dialog list symbol names
  70. GLOBAL CHECKSTATES$
  71. GLOBAL STATUSTEXT$
  72. GLOBAL DRIVETEXT$
  73.  
  74. ''Installation customizing symbols
  75. GLOBAL INSTALL_DATAFLOW$
  76. GLOBAL INSTALL_VENDORFILES$
  77.  
  78. GLOBAL CUIDLL$
  79.  
  80. DECLARE SUB AddOptFilesToCopyList (ftype%)
  81. DECLARE SUB RecalcOptFiles (ftype%)
  82. DECLARE SUB RecalcPath
  83. DECLARE SUB SetDriveStatus
  84. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  85. DECLARE FUNCTION GetWinFilterCost AS LONG
  86.  
  87. ''ACS6-6-95 Adding new subroutine
  88. DECLARE SUB ExtractZipFile( szZipFile$, szDest$, szDir$, szUnZippedFile$ )
  89.  
  90.  
  91. INIT:
  92.     CUIDLL$       = "mscuistf.dll"          '' custom user interface dll
  93.     HELPPROC$     = "FHelpDlgProc"          '' Help dialog procedure
  94.  
  95.     InitializeMyWindow  HwndFrame()
  96.     SetBitmap CUIDLL$, LOGO
  97.     SetTitle "netViz (Demo) 2.5a Setup"
  98.  
  99.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  100.     IF szInf$ = "" THEN
  101.         szInf$ = GetSymbolValue("STF_CWDDIR") + "NETVIZ.INF"
  102.     END IF
  103.     ReadInfFile szInf$
  104.  
  105.     szDataflow$ = GetSymbolValue("STF_SRCDIR") + "DATAFLOW.YES"
  106.  
  107.     IF ( DoesFileExist( szDataflow$, femExists ) ) THEN
  108.        INSTALL_DATAFLOW$ = "YES"
  109.     ELSE
  110.        INSTALL_DATAFLOW$ = "NO"
  111.     END IF
  112.  
  113.     szVendorFiles$ = GetSymbolValue("STF_SRCDIR") + "VENDOR.CU_"
  114.  
  115.  
  116.     IF ( DoesFileExist( szVendorFiles$, femExists ) ) THEN
  117.        INSTALL_VENDORFILES$ = "YES"
  118.     ELSE
  119.        INSTALL_VENDORFILES$ = "NO"
  120.     END IF
  121.  
  122.  
  123.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  124.     DEST$ = WINDRIVE$ + ":\NVDEMO25"
  125.  
  126.     ''CustInst list symbols
  127.     CHECKSTATES$ = "CheckItemsState"
  128.     STATUSTEXT$  = "StatusItemsText"
  129.     DRIVETEXT$   = "DriveStatusText"
  130.  
  131.     FOR i% = 1 TO TOTAL_STATE  STEP 1
  132.         AddListItem CHECKSTATES$ , "ON"
  133.     NEXT i%
  134.  
  135.     '' 4th one is for # of filters selected .
  136.     '' FOR i% = 1 TO (TOTAL_STATE+1) STEP 1
  137.     FOR i% = 1 TO 6 STEP 1
  138.         AddListItem STATUSTEXT$, ""
  139.     NEXT i%
  140.     FOR i% = 1 TO 7 STEP 1
  141.         AddListItem DRIVETEXT$, ""
  142.     NEXT i%
  143.  
  144.     OPTCUR$       = "ListItemsOut"
  145.     FILTERLISTS$  =  "ListItemsIn"
  146.     MakeListFromSectionKeys FILTERLISTS$, "Filters"
  147.  
  148.     ReplaceListItem DRIVETEXT$, 7, DEST$
  149.  
  150.     ''Disk cost list symbols
  151.     APPNEEDS$        = "AppNeeds"
  152.     '' GRAPHICSNEEDS$   = "GraphicsNeeds"
  153.     HELPNEEDS$       = "HelpNeeds"
  154.     ''FILTERNEEDS$     = "FilterNeeds"
  155.     MOVIENEEDS$      = "MovieNeeds"
  156.  
  157.     EXTRACOSTS$ = "ExtraCosts"
  158.     BIGLIST$    = "BigList"
  159.  
  160.     '' 1st installation dir , 2nd Window Dir
  161.     FOR i% = 1 TO 2 STEP 1
  162.         AddListItem BIGLIST$, ""
  163.     NEXT i%
  164.  
  165.  
  166.     FOR i% = 1 TO 26 STEP 1
  167.         AddListItem EXTRACOSTS$, "0"
  168.     NEXT i%
  169.  
  170. ''    AddListItem OPTCUR$, "CGM (Computer Graphics Meta)"
  171. ''    AddListItem OPTCUR$, "DRW/GRF (Micrografx Designer/Graph)"
  172. ''    AddListItem OPTCUR$, "DXF (AutoCAD Interchange)"
  173. ''    AddListItem OPTCUR$, "EPS (Encapsulated Postscript)"
  174. ''    AddListItem OPTCUR$, "GIF (CompuServe)"
  175. ''    AddListItem OPTCUR$, "PCX (PaintBrush)"
  176. ''    AddListItem OPTCUR$, "TIF (Tag Image File Format)"
  177.  
  178.  
  179.     RecalcPath
  180.     SetDriveStatus
  181.  
  182.  '$IFDEF DEBUG
  183.      i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  184.  '$ENDIF ''DEBUG
  185.  
  186.  
  187. CUSTINST:
  188.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  189.  
  190.     IF sz$ = "CONTINUE" THEN
  191.        ''Install only if it will fit.
  192.         IF GetListItem(BIGLIST$, 1) <> "" THEN
  193.            GOSUB TOOBIG
  194.            GOTO CUSTINST
  195.         END IF
  196.  
  197.         IF ( GetListItem(BIGLIST$, 2) <> "" ) AND ( GetListItem( CHECKSTATES$, APPFILES) = "ON") THEN
  198.            GOSUB WINTOOBIG
  199.            GOTO CUSTINST
  200.         END IF
  201.  
  202.        ''GOTO OPTION
  203.  
  204.        UIPop 1
  205.        IF (GetListItem( CHECKSTATES$, APPFILES) = "ON") THEN
  206.           IF (DoesDirExist(DEST$) = 1) THEN
  207.              GOSUB FILE_OVERWRITE
  208.           END IF
  209.           '' GOSUB FILE_FORMAT <- The demo shouldn't care about file formats
  210.       '' ELSE
  211.       ''    UIPop 1
  212.        END IF
  213.        GOTO INSTALL
  214.  
  215.     ELSEIF sz$ = "PATH" THEN
  216.         GOTO GETPATH
  217.  
  218.     ELSEIF sz$ = "CHK1" THEN
  219.        RecalcOptFiles APPFILES
  220.        SetDriveStatus
  221.        GOTO CUSTINST
  222.  
  223. ''    ELSEIF sz$ = "CHK2" THEN
  224. ''       RecalcOptFiles GRAPHICS
  225. ''       SetDriveStatus
  226. ''       GOTO CUSTINST
  227.  
  228.     ELSEIF sz$ = "CHK2" THEN
  229.        RecalcOptFiles HELPFILES
  230.        SetDriveStatus
  231.        GOTO CUSTINST
  232.  
  233. ''    ELSEIF sz$ = "CHK3" THEN
  234. ''       RecalcOptFiles MOVIE
  235. ''       SetDriveStatus
  236. ''       GOTO CUSTINST
  237.  
  238. ''    ELSEIF sz$ = "CHK5" THEN
  239. ''       RecalcOptFiles FILTERS
  240. ''       SetDriveStatus
  241. ''       GOTO CUSTINST
  242.  
  243. ''    ELSEIF sz$ = "BTN1" THEN
  244. ''        GOTO OPTFILES1
  245.  
  246.     ELSEIF sz$ = "REACTIVATE" THEN
  247.         RecalcPath
  248.         SetDriveStatus
  249.         GOTO CUSTINST
  250.  
  251.     ELSE
  252.         GOSUB ASKQUIT
  253.         GOTO CUSTINST
  254.     END IF
  255.  
  256.  
  257. OPTFILES1:
  258.     ''   OPTCUR$        -->  "ListItemsOut"
  259.     ''   FILTERLISTS$   -->  "ListItemsIn"
  260. OPT1:
  261.     sz$ = UIStartDlg(CUIDLL$, MULTILIST, "FMultiDlgProc", APPHELP, HELPPROC$)
  262.  
  263.     IF sz$ = "CONTINUE" THEN
  264.  
  265.         UIPop(1)
  266.         ''RecalcOptFiles APPFILES
  267.         RecalcOptFiles FILTERS
  268.         SetDriveStatus
  269.         GOTO CUSTINST
  270.  
  271.     ELSEIF sz$ = "REACTIVATE" THEN
  272.         RecalcPath   '' ????
  273.         SetDriveStatus
  274.         GOTO OPT1
  275.     ELSEIF sz$ = "EXIT" THEN
  276.         GOSUB ASKQUIT
  277.         GOTO OPT1
  278.     ELSE
  279.         UIPop 1
  280.         GOTO CUSTINST
  281.  
  282.     END IF
  283.  
  284.  
  285. INSTALL:
  286.  
  287.    ClearCopyList
  288.  
  289.    AddOptFilesToCopyList ZIPAPPFILES
  290.  
  291.    IF GetListItem( CHECKSTATES$, HELPFILES) = "ON"  THEN
  292.       AddOptFilesToCopyList ZIPHELPFILES
  293.    END IF
  294.  
  295. ''   AddOptFilesToCopyList FILTERS
  296.  
  297.    IF ( GetListItem( CHECKSTATES$, MOVIE) = "ON") THEN
  298.       AddOptFilesToCopyList ZIPMOVIE
  299.    END IF
  300.  
  301.    IF ( GetListItem( CHECKSTATES$, APPFILES) = "ON" )  THEN
  302.      IF DoesDirExist( DEST$ )  THEN
  303.        RemoveFile  MakePath(DEST$,"NVFORM.DLL"), cmoForce
  304.        RemoveFile  MakePath(DEST$,"NVUSER.DLL"), cmoForce
  305.        RemoveFile  MakePath(DEST$,"NVUSER2.DLL"), cmoForce
  306.        RemoveFile  MakePath(DEST$,"NETCONV3.EXE"), cmoForce
  307.      END IF
  308.  
  309.      WINDIRNVINI$ = MakePath( GetWindowsDir(), "NETVIZ.INI")
  310.      IF ( DoesFileExist( WINDIRNVINI$, femExists ) ) THEN
  311.        PREVRENAMEDINI$ = MakePath( GetWindowsDir(), "NETVIZ.IN$")
  312.        IF ( DoesFileExist( PREVRENAMEDINI$, femExists ) ) THEN
  313.           RemoveFile PREVRENAMEDINI$, cmoForce
  314.        ENDIF
  315.        RenameFile WINDIRNVINI$, "NETVIZ.IN$"
  316.      ENDIF
  317.      WINDIRNVINI$ = ""
  318.  
  319.    END IF
  320.  
  321.    CreateDir DEST$, cmoNone
  322.    PREV$ = FindFileInTree("netviz.exe",DEST$)
  323.  
  324.    IF GetListItem( CHECKSTATES$, APPFILES) = "ON"  THEN
  325.        '' 9 bitmaps shown   ''ACS6-9-95
  326.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 5
  327.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 5
  328.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  329.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  330.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  331.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  332.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  333.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  334.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  335.        AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  336. ''ACS6-8-95 Removed some of the billboard bitmaps
  337. ''       AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  338. ''       AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  339. ''       AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10
  340.     END IF
  341.  
  342.     height%  = GetScreenHeight()/ 15
  343.     width%   = -1
  344.     SetCopyGaugePosition width%, height%
  345. ''DumpCopyList "r:\acstmp\nvd20zip\copylist.dmp"
  346.     CopyFilesInCopyList
  347.     SetCopyGaugePosition width%, height%
  348.  
  349.  
  350.    IF GetListItem( CHECKSTATES$, APPFILES) = "ON"  THEN
  351.       SetSymbolValue "StatusText", "Extracting the Program files"          
  352.       ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" )    
  353.  
  354.       ExtractZipFile "\PROGRAM\program1.zip ", DEST$, "\PROGRAM ", "PROGRAM\bc40rtl.dll" 
  355.       ExtractZipFile "\PROGRAM\program2.zip ", DEST$, "\PROGRAM ", "PROGRAM\nvdiag.dll" 
  356.       ExtractZipFile "\PROGRAM\program3.zip ", DEST$, "\PROGRAM ", "PROGRAM\nvsym.dll" 
  357.       ExtractZipFile "\filters\filter.zip ", DEST$, "\Filters ", "filters\nvogif.dll" 
  358.  
  359.       '' Remove the modeless status dialog box
  360.       ''UIPop 1
  361.  
  362.       SetSymbolValue "StatusText", "Extracting the Sample files"          
  363.       ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" )    
  364.  
  365.       ExtractZipFile "\samples\samples.zip ", DEST$, "\SAMPLES ", "samples\sample1.net" 
  366.  
  367.       '' Remove the modeless status dialog box
  368.       ''UIPop 1
  369.  
  370.       SetSymbolValue "StatusText", "Extracting the Graphics files"          
  371.       ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" )    
  372.  
  373.       ExtractZipFile "\graphics\graphics.zip ", DEST$, "\GRAPHICS ", "graphics\polyline.nvs" 
  374.  
  375.       '' Remove the modeless status dialog box
  376.       ''UIPop 1
  377.  
  378.    ENDIF
  379.  
  380.    IF GetListItem( CHECKSTATES$, HELPFILES) = "ON"  THEN
  381.       SetSymbolValue "StatusText", "Extracting the netViz Help file"          
  382.       ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" )    
  383.  
  384.       ExtractZipFile "\PROGRAM\nvhelp.zip ", DEST$, "\PROGRAM ", "PROGRAM\netviz.HLP" 
  385.  
  386.       '' Remove the modeless status dialog box
  387.       ''UIPop 1
  388.    ENDIF
  389.  
  390.    ''IF ( GetListItem( CHECKSTATES$, MOVIE) = "ON") THEN
  391.     ''  SetSymbolValue "StatusText", "Extracting the netViz Tour file"          
  392.       ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" )    
  393.  
  394.      '' ExtractZipFile "\tour\nvmovie.zip ", DEST$, "\TOUR ", "tour\nvmovie.exe" 
  395.  
  396.       '' Remove the modeless status dialog box
  397.       ''UIPop 1
  398.  
  399. ''   ENDIF
  400.  
  401.  
  402.  
  403.    IF ( GetListItem( CHECKSTATES$, APPFILES) = "ON" ) OR ( GetListItem( CHECKSTATES$, MOVIE) = "ON" )  THEN
  404.       CreateProgmanGroup "netViz Demo 2.5a", "", cmoNone
  405.       ShowProgmanGroup  "netViz Demo 2.5a", 1, cmoNone
  406.    ENDIF
  407.  
  408.    IF GetListItem( CHECKSTATES$, APPFILES) = "ON"  THEN
  409.       ini$ = MakePath( DEST$,"program\netviz.ini")
  410.       CreateIniKeyValue ini$, "Application", "Welcome","ON", cmoOverwrite
  411.  
  412.  
  413.       PATH$  = MakePath(DEST$,"FILTERS")
  414.       CreateIniKeyValue ini$, "File Paths", "Filter",PATH$, cmoOverwrite
  415.       PATH$  = ""
  416.  
  417.       helpdir$ = MakePath( DEST$, "PROGRAM" )
  418.       CreateIniKeyValue ini$, "File Paths", "Help", helpdir$, cmoOverwrite
  419.  
  420.       PATH$  = MakePath(DEST$,"SAMPLES")
  421.       CreateIniKeyValue ini$, "File Paths", "Catalog", PATH$, cmoOverwrite
  422.       CreateIniKeyValue ini$, "File Paths", "Project", PATH$, cmoOverwrite
  423.       PATH$  = ""
  424.  
  425.      ''ACS6-6-95 Added program\ directory specifier for the new dir structure
  426.       CreateProgmanItem "netViz Demo 2.5a", "netViz Demo 2.5a", MakePath(DEST$,"program\nvdemo.exe"), "", cmoOverwrite
  427.  
  428.       ''ACS7-28-95 Getting the .WRI associated file from WIN.INI and 
  429.       ''   generating run string from that.
  430.       ''NOTEPAD$  =  "write.exe " + MakePath(DEST$,"program\demoread.wri")
  431.  
  432.       NOTEPAD$ = GetIniKeyString( "WIN.INI","Extensions", "txt" )
  433.  
  434.       i% = 1
  435.  
  436.       WHILE ( i%<LEN( NOTEPAD$) AND MID$( NOTEPAD$, i%, 1) <> "^" )  
  437.           i% = i% + 1      
  438.       WEND
  439.          
  440.       IF ( i% < LEN( NOTEPAD$ )  ) THEN
  441.          NOTEPAD$ = MID$( NOTEPAD$, 1, i%-1 ) + " " + MAKEPATH(DEST$, "program\readme.txt" )
  442.       ELSE 
  443.          NOTEPAD$ = "NOTEPAD.exe " + MAKEPATH(DEST$, "program\readme.txt" )  
  444.       ENDIF  
  445.  
  446.       CreateProgmanItem "netViz Demo 2.5a", "netViz Demo 2.5a Readme", NOTEPAD$, "", cmoOverwrite
  447.  
  448.       IF (IsFileWritable ( MakePath ( GetWindowsDir(), "WIN.INI"))) THEN
  449.         CreateIniKeyValue "WIN.INI", "Extensions", "net", MakePath(DEST$,"program\netviz.exe")+" ^.net", cmoOverwrite
  450.         CreateIniKeyValue "WIN.INI", "Extensions", "cat", MakePath(DEST$,"program\netviz.exe")+" ^.cat", cmoOverwrite
  451.       ENDIF
  452.  
  453.  
  454.    END IF
  455.    PREV$ = ""
  456.  
  457.    ''ACS6-6-95 Added tour\ directory specifier for the new dir structure
  458. ''   IF ( GetListItem( CHECKSTATES$, MOVIE) = "ON") THEN
  459. ''     NV_MOVIE$ = MakePath(DEST$, "tour\nvmovie.exe /s /c")
  460. ''     CreateProgmanItem "netViz Demo 2.5a", "netViz Tour", NV_MOVIE$, "", cmoOverwrite
  461.  
  462. ''ACS6-6-95 We don't have a dataflow tour anymore.
  463. ''     IF INSTALL_DATAFLOW$ = "YES" THEN
  464. ''        NV_MOVIE$ = MakePath(DEST$, "dataflow.exe /s /c")
  465. ''        CreateProgmanItem "netViz Demo 2.5a", "netViz DataFlow Tour", NV_MOVIE$, "", cmoOverwrite
  466. ''     END IF
  467.  
  468. ''   END IF
  469.  
  470.  
  471. QUIT:
  472.     ON ERROR GOTO ERRQUIT
  473.  
  474.     IF ERR = 0 THEN
  475.         dlg% = EXITSUCCESS
  476.     ELSEIF ERR = STFQUIT THEN
  477.         dlg% = EXITQUIT
  478.     ELSE
  479.         dlg% = EXITFAILURE
  480.     END IF
  481. QUITL1:
  482.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  483.     IF sz$ = "REACTIVATE" THEN
  484.         GOTO QUITL1
  485.     END IF
  486.     UIPop 1
  487.     IF (dlg% = EXITSUCCESS) AND (GetListItem(CHECKSTATES$,APPFILES) = "ON") THEN
  488.        RUN  NOTEPAD$ , NOWAIT
  489.     END IF
  490.  
  491.     END
  492.  
  493. ERRQUIT:
  494.     i% = DoMsgBox("Setup sources were corrupted.  Please call Quyen Systems at (301)-258-5087!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  495.     END
  496.  
  497.  
  498.  
  499. GETPATH:
  500.     SetSymbolValue "EditTextIn", DEST$
  501.     SetSymbolValue "EditFocus", "END"
  502. GETPATHL1:
  503.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  504.  
  505.     IF sz$ = "CONTINUE" THEN
  506.         olddest$ = DEST$
  507.         DEST$ = GetSymbolValue("EditTextOut")
  508.  
  509.         ''Validate new path.
  510.         IF IsDirWritable(DEST$) = 0 THEN
  511.             '' new line
  512.             DEST$ = olddest$
  513.             GOSUB BADPATH
  514.             GOTO GETPATHL1
  515.         END IF
  516.         UIPop 1
  517.  
  518.         ''Truncate display if too long.
  519.         IF LEN(DEST$) > 23 THEN
  520.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  521.         ELSE
  522.             ReplaceListItem DRIVETEXT$, 7, DEST$
  523.         END IF
  524.  
  525.         ''Recalc if path changed.
  526.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  527.             RecalcPath
  528.             SetDriveStatus
  529.         END IF
  530.  
  531.         olddest$ = ""
  532.         GOTO CUSTINST
  533.     ELSEIF sz$ = "REACTIVATE" THEN
  534.         RecalcPath
  535.         SetDriveStatus
  536.         GOTO GETPATHL1
  537.     ELSEIF sz$ = "EXIT" THEN
  538.         GOSUB ASKQUIT
  539.         GOTO GETPATHL1
  540.     ELSE
  541.         UIPop 1
  542.         GOTO CUSTINST
  543.     END IF
  544.  
  545.  
  546.  
  547. TOOBIG:
  548.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  549.     IF sz$ = "REACTIVATE" THEN
  550.         RecalcPath
  551.         SetDriveStatus
  552.         GOTO TOOBIG
  553.     END IF
  554.     UIPop 1
  555.     RETURN
  556.  
  557.  
  558. WINTOOBIG:
  559.     sz$ = UIStartDlg(CUIDLL$, WINTOOBIG, "FInfo0DlgProc", 0, "")
  560.     IF sz$ = "REACTIVATE" THEN
  561.         RecalcPath
  562.         SetDriveStatus
  563.         GOTO WINTOOBIG
  564.     END IF
  565.     UIPop 1
  566.     RETURN
  567.  
  568.  
  569.  
  570. BADPATH:
  571.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  572.     IF sz$ = "REACTIVATE" THEN
  573.         RecalcPath
  574.         SetDriveStatus
  575.         GOTO BADPATH
  576.     END IF
  577.     UIPop 1
  578.     RETURN
  579.  
  580.  
  581.  
  582. ASKQUIT:
  583.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  584.  
  585.     IF sz$ = "EXIT" THEN
  586.         UIPopAll
  587.         ERROR STFQUIT
  588.     ELSEIF sz$ = "REACTIVATE" THEN
  589.         GOTO ASKQUIT
  590.     ELSE
  591.         UIPop 1
  592.     END IF
  593.     RETURN
  594.  
  595.  
  596. FILE_OVERWRITE:
  597.     sz$ = UIStartDlg(CUIDLL$, FILE_OVERWRITE, "FQuitDlgProc", 0, "")
  598.  
  599.     IF sz$ = "EXIT" THEN
  600.         UIPopAll
  601.         ERROR STFQUIT
  602.     ELSEIF sz$ = "REACTIVATE" THEN
  603.         GOTO FILE_OVERWRITE
  604.     END IF
  605.     '' UIPopAll
  606.     UIPop 1
  607.     RETURN
  608.  
  609.  
  610. FILE_FORMAT:
  611.     sz$ = UIStartDlg(CUIDLL$, FILE_FORMAT, "FQuitDlgProc", 0, "")
  612.  
  613.     IF sz$ = "EXIT" THEN
  614.         UIPopAll
  615.         ERROR STFQUIT
  616.     ELSEIF sz$ = "REACTIVATE" THEN
  617.         GOTO FILE_FORMAT
  618.     END IF
  619.     '' UIPopAll
  620.     UIPop 1
  621.     RETURN
  622.  
  623.  
  624. '**
  625. '** Purpose:
  626. '**     Adds the specified option files to the copy list.
  627. '** Arguments:
  628. '**     ftype%  - type of files to add, one of the following:
  629. '**             APPFILES, OPTFILES1, OPTFILES2
  630. '** Returns:
  631. '**     none.
  632. '*************************************************************************
  633. SUB AddOptFilesToCopyList (ftype%) STATIC
  634.    IF ( ftype%>10 ) THEN
  635.       SrcDir$ = GetSymbolValue("STF_SRCDIR")
  636.       IF ftype% = ZIPAPPFILES THEN
  637.          AddSectionFilesToCopyList "ZIPPrograms",   SrcDir$, DEST$
  638.          AddSectionFilesToCopyList "ZIPSamples",    SrcDir$, MakePath(DEST$,"SAMPLES")
  639.          AddSectionFilesToCopyList "ZIPGraphics",    SrcDir$, MakePath(DEST$,"GRAPHICS")
  640.  
  641.          ''ACS6-8-95 Moving Vendor.cus to program directory
  642.          IF INSTALL_VENDORFILES$ = "YES" THEN
  643.             AddSectionFilesToCopyList "Vendor Files", SrcDir$, MakePath(DEST$, "PROGRAM")
  644.          END IF
  645.       ELSEIF ftype% = ZIPHELPFILES THEN
  646.          AddSectionFilesToCopyList "ZIPHelp", SrcDir$, MakePath(DEST$,"PROGRAM")
  647. ''      ELSEIF ftype% = ZIPMOVIE THEN
  648. ''         AddSectionFilesToCopyList "ZIPMovie", SrcDir$, DEST$
  649.       ENDIF
  650.  
  651.    ELSEIF GetListItem( CHECKSTATES$, ftype%) = "ON"  THEN
  652.       SrcDir$ = GetSymbolValue("STF_SRCDIR")
  653.       IF ftype% = APPFILES THEN
  654.          AddSectionFilesToCopyList "Programs",   SrcDir$, DEST$
  655.          AddSectionFilesToCopyList "Samples",    SrcDir$, MakePath(DEST$,"SAMPLES")
  656. ''ACS5-26-95 Added line
  657.          AddSectionFilesToCopyList "Graphics",    SrcDir$, MakePath(DEST$,"GRAPHICS")
  658.  
  659.          ''ACS6-8-95 Moving Vendor.cus to program directory
  660.          IF INSTALL_VENDORFILES$ = "YES" THEN
  661.             AddSectionFilesToCopyList "Vendor Files", SrcDir$, MakePath(DEST$, "PROGRAM")
  662.          END IF
  663.  
  664. ''         AddSectionFilesToCopyList "Tutorial",   SrcDir$, MakePath(DEST$,"SAMPLES")
  665. ''         AddSectionFilesToCopyList "MustFilter", SrcDir$, MakePath(DEST$,"FILTERS")
  666. ''         AddSectionFilesToCopyList "WinFilter",  SrcDir$, MakePath( GetWindowsDir,"SYSTEM")
  667. ''ACS5-26-95         AddSectionFilesToCopyList "INI_File",   SrcDir$, DEST$
  668. ''ACS5-26-95         PATH$ = MakePath(DEST$,"GRAPHICS")
  669. ''ACS5-26-95         AddSectionFilesToCopyList "Graphics",   SrcDir$, PATH$
  670. ''ACS5-26-95         AddSectionFilesToCopyList "Map",        SrcDir$, MakePath(PATH$,"MAP")
  671. ''ACS5-26-95         AddSectionFilesToCopyList "Flowsymb",   SrcDir$, MakePath(PATH$,"FLOWSYMB")
  672. ''ACS5-26-95         AddSectionFilesToCopyList "Computer",   SrcDir$, MakePath(PATH$,"COMPUTER")
  673. ''         PATH$ = MakePath(PATH$,"COMPUTER" )
  674. ''         AddSectionFilesToCopyList "Front",      SrcDir$, MakePath(PATH$,"FRONT")
  675. ''         AddSectionFilesToCopyList "Other",      SrcDir$, MakePath(PATH$,"OTHER")
  676. ''         AddSectionFilesToCopyList "Side",       SrcDir$, MakePath(PATH$,"SIDE")
  677. ''         AddSectionFilesToCopyList "Top",        SrcDir$, MakePath(PATH$,"TOP")
  678.          PATH$ = ""
  679.       ELSEIF ftype% = HELPFILES THEN
  680.          AddSectionFilesToCopyList "Help", SrcDir$, MakePath(DEST$,"PROGRAM" )
  681. ''      ELSEIF ( ftype% = FILTERS ) AND ( LEN(OPTCUR$) > 0) THEN
  682. ''         nIndexStart%  =  GetListLength(OPTCUR$)
  683. ''         FOR i% = 1 TO nIndexStart% STEP 1
  684. ''            szStr$ = GetListItem( OPTCUR$,i%)
  685. ''            AddSectionKeyFileToCopyList "Filters", szStr$, SrcDir$, MakePath(DEST$,"FILTERS")
  686. ''         NEXT i%
  687. ''         szStr$  = ""
  688. ''      ELSEIF ftype% = MOVIE THEN
  689. ''         AddSectionFilesToCopyList "Movie", SrcDir$, DEST$
  690.  
  691. ''ACS5-26-95         IF INSTALL_DATAFLOW$ = "YES" THEN
  692. ''ACS5-26-95            AddSectionFilesToCopyList "Dataflow Tour", SrcDir$, DEST$
  693. ''ACS5-26-95         END IF
  694.  
  695.       END IF
  696.  
  697.       SrcDir$ = ""
  698.  
  699.    END IF
  700. END SUB
  701.  
  702.  
  703. '**
  704. '** Purpose:
  705. '**     Recalculates disk space for the given option files and sets
  706. '**     the status info symbol "StatusItemsText".
  707. '** Arguments:
  708. '**     ftype% - type of files to add, one of the following:
  709. '**             APPFILES, OPTFILES1, OPTFILES2
  710. '** Returns:
  711. '**     none.
  712. '*************************************************************************
  713. SUB RecalcOptFiles (ftype%) STATIC
  714.  
  715.     CursorSave% = ShowWaitCursor()
  716.     ClearCopyList
  717.     AddOptFilesToCopyList ftype%
  718.  
  719.     ''fExtra% = 0
  720.     IF ftype% = APPFILES THEN
  721.        ListSym$ = APPNEEDS$
  722. ''    ELSEIF ftype% = GRAPHICS THEN
  723. ''        ListSym$ = GRAPHICSNEEDS$
  724.     ELSEIF ftype% = HELPFILES THEN
  725.         ListSym$ = HELPNEEDS$
  726. ''    ELSEIF ftype% = FILTERS THEN
  727. ''        ListSym$ = FILTERNEEDS$
  728. ''    ELSEIF ftype% = MOVIE THEN
  729. ''        ListSym$ = MOVIENEEDS$
  730.     END IF
  731.  
  732.  
  733.     drive$ = MID$(DEST$, 1, 1)
  734.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  735.  
  736.     '' StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  737.     StillNeed& = GetCopyListCost("", ListSym$, "")
  738.  
  739.     cost& =  VAL( GetListItem( ListSym$, ndrive%) )
  740.     IF  WINDRIVE$  <>  drive$  THEN
  741.       ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  742.       cost& = cost& + VAL( GetListItem( ListSym$, ndrive%) )
  743.     END IF
  744.  
  745.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  746. ''    IF  ftype% = FILTERS  THEN
  747. ''       ReplaceListItem STATUSTEXT$, ftype+1, "( " + STR$(GetListLength(OPTCUR$)) + " of " + STR$(GetListLength(FILTERLISTS$))+" filters selected )"
  748. ''    END IF
  749.  
  750.     ''IF fExtra% THEN
  751.     ''    ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  752.     ''END IF
  753.  
  754.     drive$ = MID$(DEST$, 1, 1)
  755.  
  756.     IF  WINDRIVE$  =  drive$  THEN
  757.         ReplaceListItem BIGLIST$, 2, ""
  758.     ELSE
  759.       IF GetFreeSpaceForDrive(Windrive$) < GetWinFilterCost  THEN
  760.         ReplaceListItem BIGLIST$, 2, "YES"
  761.       ELSE
  762.         ReplaceListItem BIGLIST$, 2, ""
  763.       END IF
  764.     END IF
  765.  
  766.     RestoreCursor CursorSave%
  767.     ListSym$ = ""
  768.  
  769. END SUB
  770.  
  771.  
  772. '**
  773. '** Purpose:
  774. '**     Recalculates disk space and sets option status info according
  775. '**     to the current destination path.
  776. '** Arguments:
  777. '**     none.
  778. '** Returns:
  779. '**     none.
  780. '*************************************************************************
  781. SUB RecalcPath STATIC
  782.  
  783.     CursorSave% = ShowWaitCursor()
  784.  
  785.     RecalcOptFiles APPFILES
  786. ''    RecalcOptFiles GRAPHICS
  787.     RecalcOptFiles HELPFILES
  788. ''    RecalcOptFiles FILTERS
  789. ''    RecalcOptFiles MOVIE
  790.  
  791.     RestoreCursor CursorSave%
  792.  
  793. END SUB
  794.  
  795.  
  796. '**
  797. '** Purpose:
  798. '**     Sets drive status info according to latest disk space calcs.
  799. '** Arguments:
  800. '**     none.
  801. '** Returns:
  802. '**     none.
  803. '*************************************************************************
  804. SUB SetDriveStatus STATIC
  805.  
  806.     drive$  = MID$(DEST$, 1, 1)
  807.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  808.     cost&   = 0
  809.  
  810.     IF ( GetListItem( CHECKSTATES$, APPFILES) = "ON" ) THEN
  811.       cost&   = cost& + VAL( GetListItem(APPNEEDS$, ndrive%) )
  812.     END IF
  813.  
  814. ''    IF ( GetListItem( CHECKSTATES$, GRAPHICS) = "ON" ) THEN
  815. ''      cost&   = cost& + VAL( GetListItem(GRAPHICSNEEDS$, ndrive%) )
  816. ''    END IF
  817.  
  818.     IF ( GetListItem( CHECKSTATES$, HELPFILES) = "ON" ) THEN
  819.       cost&   = cost& + VAL( GetListItem(HELPNEEDS$, ndrive%) )
  820.     END IF
  821.  
  822. ''    IF ( GetListItem( CHECKSTATES$, FILTERS) = "ON" ) THEN
  823. ''      cost&   = cost& + VAL( GetListItem(FILTERNEEDS$, ndrive%) )
  824. ''    END IF
  825.  
  826. ''    IF ( GetListItem( CHECKSTATES$, MOVIE ) = "ON" ) THEN
  827. ''      cost&   = cost& + VAL( GetListItem(MOVIENEEDS$, ndrive%) )
  828. ''    END IF
  829.  
  830.     free& = GetFreeSpaceForDrive(drive$)
  831.  
  832.     ReplaceListItem DRIVETEXT$, 1, drive$ + " :"
  833.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  834.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  835.  
  836. ''ACS6-9-95 Adding in overhead cost of ZIP files
  837.     cost& = cost& + 101474
  838.  
  839.     IF cost& > free& THEN
  840.         ReplaceListItem BIGLIST$, 1, "YES"
  841.     ELSE
  842.         ReplaceListItem BIGLIST$, 1, ""
  843.     END IF
  844.  
  845.  
  846.     ''ReplaceListItem DRIVETEXT$, 4, ""
  847.     ''ReplaceListItem DRIVETEXT$, 5, ""
  848.     ''ReplaceListItem DRIVETEXT$, 6, ""
  849.  
  850. END SUB
  851.  
  852. '**
  853. '** Purpose:
  854. '**     Appends a file name to the end of a directory path,
  855. '**     inserting a backslash character as needed.
  856. '** Arguments:
  857. '**     szDir$  - full directory path (with optional ending "\")
  858. '**     szFile$ - filename to append to directory
  859. '** Returns:
  860. '**     Resulting fully qualified path name.
  861. '*************************************************************************
  862. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  863.     IF szDir$ = "" THEN
  864.         MakePath = szFile$
  865.     ELSEIF szFile$ = "" THEN
  866.         MakePath = szDir$
  867.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  868.         MakePath = szDir$ + szFile$
  869.     ELSE
  870.         MakePath = szDir$ + "\" + szFile$
  871.     END IF
  872. END FUNCTION
  873.  
  874.  
  875. FUNCTION GetWinFilterCost  STATIC AS LONG
  876.    GetWinFilterCost = 25000
  877. END FUNCTION
  878.  
  879. SUB ExtractZipFile( szZipFile$, szDest$, szDir$, szUnZippedFile$ ) STATIC
  880.  
  881.     szSysIni$ = "c:\windows\system.ini"
  882.     nExist% = DoesIniKeyExist( szSysIni, "386Enh", "WinExclusive" )
  883.     szField$ = CHR$(1)
  884.  
  885.     IF ( nExist% = 1 ) THEN
  886.       szIniLine$ = GetIniKeyString( szSysIni, "386Enh", "WinExclusive")
  887.       szField$ = GetNthFieldFromIniString( szIniLine$, 1 )
  888.     END IF
  889.  
  890.     '' The -o is for overwrite existing files
  891.     PKUNZIP$  =  GetSymbolValue("STF_CWDDIR")+"nvunzip.pif -o "
  892.  
  893.     ZIPCMD$ = PKUNZIP$ + szDest$ + szZipFile$
  894.     ZIPCMD$ = ZIPCMD$ +  szDest$ + szDir$
  895.  
  896.  
  897. ''ACS6-6-95 This isn't the prettiest way to do this, but since Microsoft's
  898. ''    compress isn't as efficient as PKZip, when you want to fit everything
  899. ''    onto two or even one disks, you have to be creative.  Also, unfortunately, when
  900. ''    you don't have the unzip library for Windows...
  901.  
  902.     '' Show the time killing Modeless dialog boxes.
  903.  
  904.     sz$ = UIStartDlg( CUIDLL$, SAMPLE, "FModelessDlgProc", 0, "" )
  905.  
  906.     sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" )
  907.  
  908.     '' Run the PKUNZIP to extract the files.  This will return immediately
  909.     '' requiring the rest of the code which simply waits for the DOS box
  910.     '' to finish it's task and allow us to continue.  Then we test if the
  911.     '' files were extracted correctly.  If so, erase the zip file, if not
  912.     '' inform the user.
  913.  
  914.     ''SW_HIDE             0
  915.     ''SW_SHOWNORMAL       1
  916.     ''SW_NORMAL           1
  917.     ''SW_SHOWMINIMIZED    2
  918.     ''SW_SHOWMAXIMIZED    3
  919.     ''SW_MAXIMIZE         3
  920.     ''SW_SHOWNOACTIVATE   4
  921.     ''SW_SHOW             5
  922.     ''SW_MINIMIZE         6
  923.     ''SW_SHOWMINNOACTIVE  7
  924.     ''SW_SHOWNA           8
  925.     ''SW_RESTORE          9
  926.  
  927.     hPrevCursor% = ShowWaitCursor()
  928.     IF ( ASC(szField$) = 0 ) THEN
  929.       i% = WinExec( ZIPCMD$, 7 )
  930.     ELSE
  931.       i% = WinExec( ZIPCMD$, 1 )
  932.     END IF
  933.  
  934.     i% = FindWindow( "tty", "Extracting files..." )
  935.  
  936.     WHILE  i% <> 0
  937.        SLEEP( 1 )
  938.        i% = FindWindow( "tty", "Extracting files..." )
  939.     WEND
  940.  
  941.     '' Remove the modeless dialog boxes
  942.     UIPop 1
  943.  
  944.     UIPop 1
  945.  
  946.     RestoreCursor hPrevCursor%
  947.  
  948.     szTestFile$ = MakePath( szDest$, szUnZippedFile$ )
  949.  
  950.     IF DoesFileExist( szTestFile$, femExists ) THEN
  951.        RemoveFile DEST$+szZipFile$, cmoNone
  952.     ELSE
  953.        i% = DoMsgBox( "An error may have occured while unzipping " + szZipFile$ + ". You may want to unzip and delete it later.", "netViz Demo Setup", MB_OK )
  954.     ENDIF
  955.  
  956. END SUB
  957.