home *** CD-ROM | disk | FTP | other *** search
Wrap
'************************************************************************** '* MSSetup Toolkit Sample 2 '************************************************************************** ''$DEFINE DEBUG ''Define for script development/debugging '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' DECLARE SUB InitializeMyWindow LIB "mscuistf.dll" (hMainWind% ) ''ACS6-5-95 Stolen from MS Test winapi16.inc DECLARE FUNCTION WinExec LIB "Kernel" (sz$, w%) As INTEGER DECLARE FUNCTION FindWindow LIB "User" (sz$, sz$) As INTEGER ''Dialog ID's CONST ASKQUIT = 200 CONST DESTPATH = 300 CONST EXITFAILURE = 400 CONST EXITQUIT = 600 CONST EXITSUCCESS = 700 CONST FILE_OVERWRITE = 800 CONST FILE_FORMAT = 900 CONST APPHELP = 1000 CONST MULTILIST = 5200 CONST CUSTINST = 6200 CONST TOOBIG = 6300 CONST BADPATH = 6400 CONST SAMPLE = 6500 CONST EXPANDINGFILES = 6550 CONST WINTOOBIG = 6600 ''Message Box Constants CONST IDYES = 6 CONST MB_ICONQUESTION = 32 CONST MB_YESNO = 4 ''Bitmap ID CONST LOGO = 1 ''File Types CONST APPFILES = 1 CONST HELPFILES = 2 CONST MOVIE = 3 ''CONST GRAPHICS = 4 ''CONST FILTERS = 5 CONST ZIPAPPFILES = 11 CONST ZIPHELPFILES = 12 CONST ZIPMOVIE = 13 CONST TOTAL_STATE = 3 GLOBAL DEST$ ''Default destination directory. GLOBAL WINDRIVE$ ''Windows drive letter. GLOBAL OPTCUR$ ''Option selection from option dialog. GLOBAL FILTERLISTS$ ''CustInst list symbol names GLOBAL APPNEEDS$ ''Option list costs per drive GLOBAL GRAPHICSNEEDS$ GLOBAL HELPNEEDS$ GLOBAL FILTERNEEDS$ GLOBAL MOVIENEEDS$ GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive GLOBAL BIGLIST$ ''List of option files cost calc results (boolean) ''Dialog list symbol names GLOBAL CHECKSTATES$ GLOBAL STATUSTEXT$ GLOBAL DRIVETEXT$ ''Installation customizing symbols GLOBAL INSTALL_DATAFLOW$ GLOBAL INSTALL_VENDORFILES$ GLOBAL CUIDLL$ DECLARE SUB AddOptFilesToCopyList (ftype%) DECLARE SUB RecalcOptFiles (ftype%) DECLARE SUB RecalcPath DECLARE SUB SetDriveStatus DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING DECLARE FUNCTION GetWinFilterCost AS LONG ''ACS6-6-95 Adding new subroutine DECLARE SUB ExtractZipFile( szZipFile$, szDest$, szDir$, szUnZippedFile$ ) INIT: CUIDLL$ = "mscuistf.dll" '' custom user interface dll HELPPROC$ = "FHelpDlgProc" '' Help dialog procedure InitializeMyWindow HwndFrame() SetBitmap CUIDLL$, LOGO SetTitle "netViz (Demo) 2.5a Setup" szInf$ = GetSymbolValue("STF_SRCINFPATH") IF szInf$ = "" THEN szInf$ = GetSymbolValue("STF_CWDDIR") + "NETVIZ.INF" END IF ReadInfFile szInf$ szDataflow$ = GetSymbolValue("STF_SRCDIR") + "DATAFLOW.YES" IF ( DoesFileExist( szDataflow$, femExists ) ) THEN INSTALL_DATAFLOW$ = "YES" ELSE INSTALL_DATAFLOW$ = "NO" END IF szVendorFiles$ = GetSymbolValue("STF_SRCDIR") + "VENDOR.CU_" IF ( DoesFileExist( szVendorFiles$, femExists ) ) THEN INSTALL_VENDORFILES$ = "YES" ELSE INSTALL_VENDORFILES$ = "NO" END IF WINDRIVE$ = MID$(GetWindowsDir, 1, 1) DEST$ = WINDRIVE$ + ":\NVDEMO25" ''CustInst list symbols CHECKSTATES$ = "CheckItemsState" STATUSTEXT$ = "StatusItemsText" DRIVETEXT$ = "DriveStatusText" FOR i% = 1 TO TOTAL_STATE STEP 1 AddListItem CHECKSTATES$ , "ON" NEXT i% '' 4th one is for # of filters selected . '' FOR i% = 1 TO (TOTAL_STATE+1) STEP 1 FOR i% = 1 TO 6 STEP 1 AddListItem STATUSTEXT$, "" NEXT i% FOR i% = 1 TO 7 STEP 1 AddListItem DRIVETEXT$, "" NEXT i% OPTCUR$ = "ListItemsOut" FILTERLISTS$ = "ListItemsIn" MakeListFromSectionKeys FILTERLISTS$, "Filters" ReplaceListItem DRIVETEXT$, 7, DEST$ ''Disk cost list symbols APPNEEDS$ = "AppNeeds" '' GRAPHICSNEEDS$ = "GraphicsNeeds" HELPNEEDS$ = "HelpNeeds" ''FILTERNEEDS$ = "FilterNeeds" MOVIENEEDS$ = "MovieNeeds" EXTRACOSTS$ = "ExtraCosts" BIGLIST$ = "BigList" '' 1st installation dir , 2nd Window Dir FOR i% = 1 TO 2 STEP 1 AddListItem BIGLIST$, "" NEXT i% FOR i% = 1 TO 26 STEP 1 AddListItem EXTRACOSTS$, "0" NEXT i% '' AddListItem OPTCUR$, "CGM (Computer Graphics Meta)" '' AddListItem OPTCUR$, "DRW/GRF (Micrografx Designer/Graph)" '' AddListItem OPTCUR$, "DXF (AutoCAD Interchange)" '' AddListItem OPTCUR$, "EPS (Encapsulated Postscript)" '' AddListItem OPTCUR$, "GIF (CompuServe)" '' AddListItem OPTCUR$, "PCX (PaintBrush)" '' AddListItem OPTCUR$, "TIF (Tag Image File Format)" RecalcPath SetDriveStatus '$IFDEF DEBUG i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal '$ENDIF ''DEBUG CUSTINST: sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN ''Install only if it will fit. IF GetListItem(BIGLIST$, 1) <> "" THEN GOSUB TOOBIG GOTO CUSTINST END IF IF ( GetListItem(BIGLIST$, 2) <> "" ) AND ( GetListItem( CHECKSTATES$, APPFILES) = "ON") THEN GOSUB WINTOOBIG GOTO CUSTINST END IF ''GOTO OPTION UIPop 1 IF (GetListItem( CHECKSTATES$, APPFILES) = "ON") THEN IF (DoesDirExist(DEST$) = 1) THEN GOSUB FILE_OVERWRITE END IF '' GOSUB FILE_FORMAT <- The demo shouldn't care about file formats '' ELSE '' UIPop 1 END IF GOTO INSTALL ELSEIF sz$ = "PATH" THEN GOTO GETPATH ELSEIF sz$ = "CHK1" THEN RecalcOptFiles APPFILES SetDriveStatus GOTO CUSTINST '' ELSEIF sz$ = "CHK2" THEN '' RecalcOptFiles GRAPHICS '' SetDriveStatus '' GOTO CUSTINST ELSEIF sz$ = "CHK2" THEN RecalcOptFiles HELPFILES SetDriveStatus GOTO CUSTINST '' ELSEIF sz$ = "CHK3" THEN '' RecalcOptFiles MOVIE '' SetDriveStatus '' GOTO CUSTINST '' ELSEIF sz$ = "CHK5" THEN '' RecalcOptFiles FILTERS '' SetDriveStatus '' GOTO CUSTINST '' ELSEIF sz$ = "BTN1" THEN '' GOTO OPTFILES1 ELSEIF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO CUSTINST ELSE GOSUB ASKQUIT GOTO CUSTINST END IF OPTFILES1: '' OPTCUR$ --> "ListItemsOut" '' FILTERLISTS$ --> "ListItemsIn" OPT1: sz$ = UIStartDlg(CUIDLL$, MULTILIST, "FMultiDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN UIPop(1) ''RecalcOptFiles APPFILES RecalcOptFiles FILTERS SetDriveStatus GOTO CUSTINST ELSEIF sz$ = "REACTIVATE" THEN RecalcPath '' ???? SetDriveStatus GOTO OPT1 ELSEIF sz$ = "EXIT" THEN GOSUB ASKQUIT GOTO OPT1 ELSE UIPop 1 GOTO CUSTINST END IF INSTALL: ClearCopyList AddOptFilesToCopyList ZIPAPPFILES IF GetListItem( CHECKSTATES$, HELPFILES) = "ON" THEN AddOptFilesToCopyList ZIPHELPFILES END IF '' AddOptFilesToCopyList FILTERS IF ( GetListItem( CHECKSTATES$, MOVIE) = "ON") THEN AddOptFilesToCopyList ZIPMOVIE END IF IF ( GetListItem( CHECKSTATES$, APPFILES) = "ON" ) THEN IF DoesDirExist( DEST$ ) THEN RemoveFile MakePath(DEST$,"NVFORM.DLL"), cmoForce RemoveFile MakePath(DEST$,"NVUSER.DLL"), cmoForce RemoveFile MakePath(DEST$,"NVUSER2.DLL"), cmoForce RemoveFile MakePath(DEST$,"NETCONV3.EXE"), cmoForce END IF WINDIRNVINI$ = MakePath( GetWindowsDir(), "NETVIZ.INI") IF ( DoesFileExist( WINDIRNVINI$, femExists ) ) THEN PREVRENAMEDINI$ = MakePath( GetWindowsDir(), "NETVIZ.IN$") IF ( DoesFileExist( PREVRENAMEDINI$, femExists ) ) THEN RemoveFile PREVRENAMEDINI$, cmoForce ENDIF RenameFile WINDIRNVINI$, "NETVIZ.IN$" ENDIF WINDIRNVINI$ = "" END IF CreateDir DEST$, cmoNone PREV$ = FindFileInTree("netviz.exe",DEST$) IF GetListItem( CHECKSTATES$, APPFILES) = "ON" THEN '' 9 bitmaps shown ''ACS6-9-95 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 5 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 5 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 ''ACS6-8-95 Removed some of the billboard bitmaps '' AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 '' AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 '' AddToBillboardList "mscuistf.dll", SAMPLE, "FModelessDlgProc", 10 END IF height% = GetScreenHeight()/ 15 width% = -1 SetCopyGaugePosition width%, height% ''DumpCopyList "r:\acstmp\nvd20zip\copylist.dmp" CopyFilesInCopyList SetCopyGaugePosition width%, height% IF GetListItem( CHECKSTATES$, APPFILES) = "ON" THEN SetSymbolValue "StatusText", "Extracting the Program files" ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" ) ExtractZipFile "\PROGRAM\program1.zip ", DEST$, "\PROGRAM ", "PROGRAM\bc40rtl.dll" ExtractZipFile "\PROGRAM\program2.zip ", DEST$, "\PROGRAM ", "PROGRAM\nvdiag.dll" ExtractZipFile "\PROGRAM\program3.zip ", DEST$, "\PROGRAM ", "PROGRAM\nvsym.dll" ExtractZipFile "\filters\filter.zip ", DEST$, "\Filters ", "filters\nvogif.dll" '' Remove the modeless status dialog box ''UIPop 1 SetSymbolValue "StatusText", "Extracting the Sample files" ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" ) ExtractZipFile "\samples\samples.zip ", DEST$, "\SAMPLES ", "samples\sample1.net" '' Remove the modeless status dialog box ''UIPop 1 SetSymbolValue "StatusText", "Extracting the Graphics files" ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" ) ExtractZipFile "\graphics\graphics.zip ", DEST$, "\GRAPHICS ", "graphics\polyline.nvs" '' Remove the modeless status dialog box ''UIPop 1 ENDIF IF GetListItem( CHECKSTATES$, HELPFILES) = "ON" THEN SetSymbolValue "StatusText", "Extracting the netViz Help file" ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" ) ExtractZipFile "\PROGRAM\nvhelp.zip ", DEST$, "\PROGRAM ", "PROGRAM\netviz.HLP" '' Remove the modeless status dialog box ''UIPop 1 ENDIF ''IF ( GetListItem( CHECKSTATES$, MOVIE) = "ON") THEN '' SetSymbolValue "StatusText", "Extracting the netViz Tour file" ''sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" ) '' ExtractZipFile "\tour\nvmovie.zip ", DEST$, "\TOUR ", "tour\nvmovie.exe" '' Remove the modeless status dialog box ''UIPop 1 '' ENDIF IF ( GetListItem( CHECKSTATES$, APPFILES) = "ON" ) OR ( GetListItem( CHECKSTATES$, MOVIE) = "ON" ) THEN CreateProgmanGroup "netViz Demo 2.5a", "", cmoNone ShowProgmanGroup "netViz Demo 2.5a", 1, cmoNone ENDIF IF GetListItem( CHECKSTATES$, APPFILES) = "ON" THEN ini$ = MakePath( DEST$,"program\netviz.ini") CreateIniKeyValue ini$, "Application", "Welcome","ON", cmoOverwrite PATH$ = MakePath(DEST$,"FILTERS") CreateIniKeyValue ini$, "File Paths", "Filter",PATH$, cmoOverwrite PATH$ = "" helpdir$ = MakePath( DEST$, "PROGRAM" ) CreateIniKeyValue ini$, "File Paths", "Help", helpdir$, cmoOverwrite PATH$ = MakePath(DEST$,"SAMPLES") CreateIniKeyValue ini$, "File Paths", "Catalog", PATH$, cmoOverwrite CreateIniKeyValue ini$, "File Paths", "Project", PATH$, cmoOverwrite PATH$ = "" ''ACS6-6-95 Added program\ directory specifier for the new dir structure CreateProgmanItem "netViz Demo 2.5a", "netViz Demo 2.5a", MakePath(DEST$,"program\nvdemo.exe"), "", cmoOverwrite ''ACS7-28-95 Getting the .WRI associated file from WIN.INI and '' generating run string from that. ''NOTEPAD$ = "write.exe " + MakePath(DEST$,"program\demoread.wri") NOTEPAD$ = GetIniKeyString( "WIN.INI","Extensions", "txt" ) i% = 1 WHILE ( i%<LEN( NOTEPAD$) AND MID$( NOTEPAD$, i%, 1) <> "^" ) i% = i% + 1 WEND IF ( i% < LEN( NOTEPAD$ ) ) THEN NOTEPAD$ = MID$( NOTEPAD$, 1, i%-1 ) + " " + MAKEPATH(DEST$, "program\readme.txt" ) ELSE NOTEPAD$ = "NOTEPAD.exe " + MAKEPATH(DEST$, "program\readme.txt" ) ENDIF CreateProgmanItem "netViz Demo 2.5a", "netViz Demo 2.5a Readme", NOTEPAD$, "", cmoOverwrite IF (IsFileWritable ( MakePath ( GetWindowsDir(), "WIN.INI"))) THEN CreateIniKeyValue "WIN.INI", "Extensions", "net", MakePath(DEST$,"program\netviz.exe")+" ^.net", cmoOverwrite CreateIniKeyValue "WIN.INI", "Extensions", "cat", MakePath(DEST$,"program\netviz.exe")+" ^.cat", cmoOverwrite ENDIF END IF PREV$ = "" ''ACS6-6-95 Added tour\ directory specifier for the new dir structure '' IF ( GetListItem( CHECKSTATES$, MOVIE) = "ON") THEN '' NV_MOVIE$ = MakePath(DEST$, "tour\nvmovie.exe /s /c") '' CreateProgmanItem "netViz Demo 2.5a", "netViz Tour", NV_MOVIE$, "", cmoOverwrite ''ACS6-6-95 We don't have a dataflow tour anymore. '' IF INSTALL_DATAFLOW$ = "YES" THEN '' NV_MOVIE$ = MakePath(DEST$, "dataflow.exe /s /c") '' CreateProgmanItem "netViz Demo 2.5a", "netViz DataFlow Tour", NV_MOVIE$, "", cmoOverwrite '' END IF '' END IF QUIT: ON ERROR GOTO ERRQUIT IF ERR = 0 THEN dlg% = EXITSUCCESS ELSEIF ERR = STFQUIT THEN dlg% = EXITQUIT ELSE dlg% = EXITFAILURE END IF QUITL1: sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO QUITL1 END IF UIPop 1 IF (dlg% = EXITSUCCESS) AND (GetListItem(CHECKSTATES$,APPFILES) = "ON") THEN RUN NOTEPAD$ , NOWAIT END IF END ERRQUIT: i% = DoMsgBox("Setup sources were corrupted. Please call Quyen Systems at (301)-258-5087!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND) END GETPATH: SetSymbolValue "EditTextIn", DEST$ SetSymbolValue "EditFocus", "END" GETPATHL1: sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN olddest$ = DEST$ DEST$ = GetSymbolValue("EditTextOut") ''Validate new path. IF IsDirWritable(DEST$) = 0 THEN '' new line DEST$ = olddest$ GOSUB BADPATH GOTO GETPATHL1 END IF UIPop 1 ''Truncate display if too long. IF LEN(DEST$) > 23 THEN ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..." ELSE ReplaceListItem DRIVETEXT$, 7, DEST$ END IF ''Recalc if path changed. IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN RecalcPath SetDriveStatus END IF olddest$ = "" GOTO CUSTINST ELSEIF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO GETPATHL1 ELSEIF sz$ = "EXIT" THEN GOSUB ASKQUIT GOTO GETPATHL1 ELSE UIPop 1 GOTO CUSTINST END IF TOOBIG: sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO TOOBIG END IF UIPop 1 RETURN WINTOOBIG: sz$ = UIStartDlg(CUIDLL$, WINTOOBIG, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO WINTOOBIG END IF UIPop 1 RETURN BADPATH: sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN RecalcPath SetDriveStatus GOTO BADPATH END IF UIPop 1 RETURN ASKQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 END IF RETURN FILE_OVERWRITE: sz$ = UIStartDlg(CUIDLL$, FILE_OVERWRITE, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO FILE_OVERWRITE END IF '' UIPopAll UIPop 1 RETURN FILE_FORMAT: sz$ = UIStartDlg(CUIDLL$, FILE_FORMAT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO FILE_FORMAT END IF '' UIPopAll UIPop 1 RETURN '** '** Purpose: '** Adds the specified option files to the copy list. '** Arguments: '** ftype% - type of files to add, one of the following: '** APPFILES, OPTFILES1, OPTFILES2 '** Returns: '** none. '************************************************************************* SUB AddOptFilesToCopyList (ftype%) STATIC IF ( ftype%>10 ) THEN SrcDir$ = GetSymbolValue("STF_SRCDIR") IF ftype% = ZIPAPPFILES THEN AddSectionFilesToCopyList "ZIPPrograms", SrcDir$, DEST$ AddSectionFilesToCopyList "ZIPSamples", SrcDir$, MakePath(DEST$,"SAMPLES") AddSectionFilesToCopyList "ZIPGraphics", SrcDir$, MakePath(DEST$,"GRAPHICS") ''ACS6-8-95 Moving Vendor.cus to program directory IF INSTALL_VENDORFILES$ = "YES" THEN AddSectionFilesToCopyList "Vendor Files", SrcDir$, MakePath(DEST$, "PROGRAM") END IF ELSEIF ftype% = ZIPHELPFILES THEN AddSectionFilesToCopyList "ZIPHelp", SrcDir$, MakePath(DEST$,"PROGRAM") '' ELSEIF ftype% = ZIPMOVIE THEN '' AddSectionFilesToCopyList "ZIPMovie", SrcDir$, DEST$ ENDIF ELSEIF GetListItem( CHECKSTATES$, ftype%) = "ON" THEN SrcDir$ = GetSymbolValue("STF_SRCDIR") IF ftype% = APPFILES THEN AddSectionFilesToCopyList "Programs", SrcDir$, DEST$ AddSectionFilesToCopyList "Samples", SrcDir$, MakePath(DEST$,"SAMPLES") ''ACS5-26-95 Added line AddSectionFilesToCopyList "Graphics", SrcDir$, MakePath(DEST$,"GRAPHICS") ''ACS6-8-95 Moving Vendor.cus to program directory IF INSTALL_VENDORFILES$ = "YES" THEN AddSectionFilesToCopyList "Vendor Files", SrcDir$, MakePath(DEST$, "PROGRAM") END IF '' AddSectionFilesToCopyList "Tutorial", SrcDir$, MakePath(DEST$,"SAMPLES") '' AddSectionFilesToCopyList "MustFilter", SrcDir$, MakePath(DEST$,"FILTERS") '' AddSectionFilesToCopyList "WinFilter", SrcDir$, MakePath( GetWindowsDir,"SYSTEM") ''ACS5-26-95 AddSectionFilesToCopyList "INI_File", SrcDir$, DEST$ ''ACS5-26-95 PATH$ = MakePath(DEST$,"GRAPHICS") ''ACS5-26-95 AddSectionFilesToCopyList "Graphics", SrcDir$, PATH$ ''ACS5-26-95 AddSectionFilesToCopyList "Map", SrcDir$, MakePath(PATH$,"MAP") ''ACS5-26-95 AddSectionFilesToCopyList "Flowsymb", SrcDir$, MakePath(PATH$,"FLOWSYMB") ''ACS5-26-95 AddSectionFilesToCopyList "Computer", SrcDir$, MakePath(PATH$,"COMPUTER") '' PATH$ = MakePath(PATH$,"COMPUTER" ) '' AddSectionFilesToCopyList "Front", SrcDir$, MakePath(PATH$,"FRONT") '' AddSectionFilesToCopyList "Other", SrcDir$, MakePath(PATH$,"OTHER") '' AddSectionFilesToCopyList "Side", SrcDir$, MakePath(PATH$,"SIDE") '' AddSectionFilesToCopyList "Top", SrcDir$, MakePath(PATH$,"TOP") PATH$ = "" ELSEIF ftype% = HELPFILES THEN AddSectionFilesToCopyList "Help", SrcDir$, MakePath(DEST$,"PROGRAM" ) '' ELSEIF ( ftype% = FILTERS ) AND ( LEN(OPTCUR$) > 0) THEN '' nIndexStart% = GetListLength(OPTCUR$) '' FOR i% = 1 TO nIndexStart% STEP 1 '' szStr$ = GetListItem( OPTCUR$,i%) '' AddSectionKeyFileToCopyList "Filters", szStr$, SrcDir$, MakePath(DEST$,"FILTERS") '' NEXT i% '' szStr$ = "" '' ELSEIF ftype% = MOVIE THEN '' AddSectionFilesToCopyList "Movie", SrcDir$, DEST$ ''ACS5-26-95 IF INSTALL_DATAFLOW$ = "YES" THEN ''ACS5-26-95 AddSectionFilesToCopyList "Dataflow Tour", SrcDir$, DEST$ ''ACS5-26-95 END IF END IF SrcDir$ = "" END IF END SUB '** '** Purpose: '** Recalculates disk space for the given option files and sets '** the status info symbol "StatusItemsText". '** Arguments: '** ftype% - type of files to add, one of the following: '** APPFILES, OPTFILES1, OPTFILES2 '** Returns: '** none. '************************************************************************* SUB RecalcOptFiles (ftype%) STATIC CursorSave% = ShowWaitCursor() ClearCopyList AddOptFilesToCopyList ftype% ''fExtra% = 0 IF ftype% = APPFILES THEN ListSym$ = APPNEEDS$ '' ELSEIF ftype% = GRAPHICS THEN '' ListSym$ = GRAPHICSNEEDS$ ELSEIF ftype% = HELPFILES THEN ListSym$ = HELPNEEDS$ '' ELSEIF ftype% = FILTERS THEN '' ListSym$ = FILTERNEEDS$ '' ELSEIF ftype% = MOVIE THEN '' ListSym$ = MOVIENEEDS$ END IF drive$ = MID$(DEST$, 1, 1) ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1 '' StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "") StillNeed& = GetCopyListCost("", ListSym$, "") cost& = VAL( GetListItem( ListSym$, ndrive%) ) IF WINDRIVE$ <> drive$ THEN ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1 cost& = cost& + VAL( GetListItem( ListSym$, ndrive%) ) END IF ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K" '' IF ftype% = FILTERS THEN '' ReplaceListItem STATUSTEXT$, ftype+1, "( " + STR$(GetListLength(OPTCUR$)) + " of " + STR$(GetListLength(FILTERLISTS$))+" filters selected )" '' END IF ''IF fExtra% THEN '' ReplaceListItem EXTRACOSTS$, ndrive%, "0" ''END IF drive$ = MID$(DEST$, 1, 1) IF WINDRIVE$ = drive$ THEN ReplaceListItem BIGLIST$, 2, "" ELSE IF GetFreeSpaceForDrive(Windrive$) < GetWinFilterCost THEN ReplaceListItem BIGLIST$, 2, "YES" ELSE ReplaceListItem BIGLIST$, 2, "" END IF END IF RestoreCursor CursorSave% ListSym$ = "" END SUB '** '** Purpose: '** Recalculates disk space and sets option status info according '** to the current destination path. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB RecalcPath STATIC CursorSave% = ShowWaitCursor() RecalcOptFiles APPFILES '' RecalcOptFiles GRAPHICS RecalcOptFiles HELPFILES '' RecalcOptFiles FILTERS '' RecalcOptFiles MOVIE RestoreCursor CursorSave% END SUB '** '** Purpose: '** Sets drive status info according to latest disk space calcs. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB SetDriveStatus STATIC drive$ = MID$(DEST$, 1, 1) ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1 cost& = 0 IF ( GetListItem( CHECKSTATES$, APPFILES) = "ON" ) THEN cost& = cost& + VAL( GetListItem(APPNEEDS$, ndrive%) ) END IF '' IF ( GetListItem( CHECKSTATES$, GRAPHICS) = "ON" ) THEN '' cost& = cost& + VAL( GetListItem(GRAPHICSNEEDS$, ndrive%) ) '' END IF IF ( GetListItem( CHECKSTATES$, HELPFILES) = "ON" ) THEN cost& = cost& + VAL( GetListItem(HELPNEEDS$, ndrive%) ) END IF '' IF ( GetListItem( CHECKSTATES$, FILTERS) = "ON" ) THEN '' cost& = cost& + VAL( GetListItem(FILTERNEEDS$, ndrive%) ) '' END IF '' IF ( GetListItem( CHECKSTATES$, MOVIE ) = "ON" ) THEN '' cost& = cost& + VAL( GetListItem(MOVIENEEDS$, ndrive%) ) '' END IF free& = GetFreeSpaceForDrive(drive$) ReplaceListItem DRIVETEXT$, 1, drive$ + " :" ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K" ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K" ''ACS6-9-95 Adding in overhead cost of ZIP files cost& = cost& + 101474 IF cost& > free& THEN ReplaceListItem BIGLIST$, 1, "YES" ELSE ReplaceListItem BIGLIST$, 1, "" END IF ''ReplaceListItem DRIVETEXT$, 4, "" ''ReplaceListItem DRIVETEXT$, 5, "" ''ReplaceListItem DRIVETEXT$, 6, "" END SUB '** '** Purpose: '** Appends a file name to the end of a directory path, '** inserting a backslash character as needed. '** Arguments: '** szDir$ - full directory path (with optional ending "\") '** szFile$ - filename to append to directory '** Returns: '** Resulting fully qualified path name. '************************************************************************* FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING IF szDir$ = "" THEN MakePath = szFile$ ELSEIF szFile$ = "" THEN MakePath = szDir$ ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN MakePath = szDir$ + szFile$ ELSE MakePath = szDir$ + "\" + szFile$ END IF END FUNCTION FUNCTION GetWinFilterCost STATIC AS LONG GetWinFilterCost = 25000 END FUNCTION SUB ExtractZipFile( szZipFile$, szDest$, szDir$, szUnZippedFile$ ) STATIC szSysIni$ = "c:\windows\system.ini" nExist% = DoesIniKeyExist( szSysIni, "386Enh", "WinExclusive" ) szField$ = CHR$(1) IF ( nExist% = 1 ) THEN szIniLine$ = GetIniKeyString( szSysIni, "386Enh", "WinExclusive") szField$ = GetNthFieldFromIniString( szIniLine$, 1 ) END IF '' The -o is for overwrite existing files PKUNZIP$ = GetSymbolValue("STF_CWDDIR")+"nvunzip.pif -o " ZIPCMD$ = PKUNZIP$ + szDest$ + szZipFile$ ZIPCMD$ = ZIPCMD$ + szDest$ + szDir$ ''ACS6-6-95 This isn't the prettiest way to do this, but since Microsoft's '' compress isn't as efficient as PKZip, when you want to fit everything '' onto two or even one disks, you have to be creative. Also, unfortunately, when '' you don't have the unzip library for Windows... '' Show the time killing Modeless dialog boxes. sz$ = UIStartDlg( CUIDLL$, SAMPLE, "FModelessDlgProc", 0, "" ) sz$ = UIStartDlg( CUIDLL$, EXPANDINGFILES, "nVDemoModelessDlgProc", 0, "" ) '' Run the PKUNZIP to extract the files. This will return immediately '' requiring the rest of the code which simply waits for the DOS box '' to finish it's task and allow us to continue. Then we test if the '' files were extracted correctly. If so, erase the zip file, if not '' inform the user. ''SW_HIDE 0 ''SW_SHOWNORMAL 1 ''SW_NORMAL 1 ''SW_SHOWMINIMIZED 2 ''SW_SHOWMAXIMIZED 3 ''SW_MAXIMIZE 3 ''SW_SHOWNOACTIVATE 4 ''SW_SHOW 5 ''SW_MINIMIZE 6 ''SW_SHOWMINNOACTIVE 7 ''SW_SHOWNA 8 ''SW_RESTORE 9 hPrevCursor% = ShowWaitCursor() IF ( ASC(szField$) = 0 ) THEN i% = WinExec( ZIPCMD$, 7 ) ELSE i% = WinExec( ZIPCMD$, 1 ) END IF i% = FindWindow( "tty", "Extracting files..." ) WHILE i% <> 0 SLEEP( 1 ) i% = FindWindow( "tty", "Extracting files..." ) WEND '' Remove the modeless dialog boxes UIPop 1 UIPop 1 RestoreCursor hPrevCursor% szTestFile$ = MakePath( szDest$, szUnZippedFile$ ) IF DoesFileExist( szTestFile$, femExists ) THEN RemoveFile DEST$+szZipFile$, cmoNone ELSE i% = DoMsgBox( "An error may have occured while unzipping " + szZipFile$ + ". You may want to unzip and delete it later.", "netViz Demo Setup", MB_OK ) ENDIF END SUB