home *** CD-ROM | disk | FTP | other *** search
- ''' NOTE: Set the following constants for updating installer to specs...
-
- '''1 for yes, install... 0 for dont install
- CONST IsDemo = 0
- CONST InstallAppFiles = 1
- CONST InstallExampleFiles = 1
- CONST InstallLessonFiles = 1
- CONST InstallHelpFiles = 1
- CONST RemoveFilesSection = 1
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST WELCOME = 100
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST APPHELP = 900
- CONST CUSTINST = 6200
- CONST TOOBIG = 6300
- CONST BADPATH = 6400
- CONST XSUCCESS = 1000
- CONST NOFILESSELD = 1100
-
- ''Bitmap ID's
- CONST FTSBANNER = 1
- CONST DEMOBANNER = 2
-
- CONST AppFiles = 1
- CONST ExampleFiles = 2
- CONST LessonFiles = 3
- CONST HelpFiles = 4
- CONST RemoveFiles = 5
-
- CONST FTS = "FastTrack Schedule"
-
- ''' NOTE: this filename coppied to properties of icon in program mgr. case is NOT ignored in those strings.
- CONST HELPFILENAME = "FSCHHELP.HLP"
-
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL RealDest$
- GLOBAL WINDRIVE$ ''Windows drive letter.
-
- ''CustInst list symbol names
- GLOBAL APPNEEDS$ ''Option list costs per drive
- GLOBAL LessonsNeed$
- GLOBAL ExamplesNeed$
- GLOBAL HelpNeeds$
-
- 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$
- GLOBAL FileSections$
- GLOBAL CUIDLL$
-
- DECLARE SUB AddOptFilesToCopyList (ftype%)
- DECLARE SUB RecalcOptFiles (ftype%)
- DECLARE SUB RecalcPath
- DECLARE SUB SetDriveStatus
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
-
- INIT:
-
- CUIDLL$ = "mscuistf.dll" ''custom user interface dll
-
- IF IsDemo = 1 THEN
- SetTitle "Install FastTrack Schedule Demo"
- SetBitmap CUIDLL$, DEMOBANNER
- ELSE
- SetTitle "Install FastTrack Schedule"
- SetBitmap CUIDLL$, FTSBANNER
- END IF
-
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- '''NOTE: this should reflect name of .inf file indicated as parameter
- '''sent to dsklayt2
- szInf$ = GetSymbolValue("STF_CWDDIR") + "FTSINSTL.INF"
- END IF
- ReadInfFile szInf$
-
- WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
- DEST$ = WINDRIVE$ + ":\FTSCHEDL"
-
- ''CustInst list symbols
-
- FileSections$ = "FileSects"
-
- CHECKSTATES$ = "CheckItemsState"
- STATUSTEXT$ = "StatusItemsText"
- DRIVETEXT$ = "DriveStatusText"
-
- ''' NOTE: these set the initial state of check boxes. disabled checkboxes should be NO;
-
- IF InstallAppFiles <> 0 THEN
- AddListItem FileSections$, "AppFiles"
- AddListItem CHECKSTATES$, "ON"
- ELSE
- AddListItem FileSections$, ""
- AddListItem CHECKSTATES$, "OFF"
- END IF
-
- IF InstallExampleFiles <> 0 THEN
- AddListItem FileSections$, "ExampleFiles"
- AddListItem CHECKSTATES$, "ON"
- ELSE
- AddListItem FileSections$, ""
- AddListItem CHECKSTATES$, "OFF"
- END IF
-
- IF InstallLessonFiles <> 0 THEN
- AddListItem FileSections$, "LessonFiles"
- AddListItem CHECKSTATES$, "ON"
- ELSE
- AddListItem FileSections$, ""
- AddListItem CHECKSTATES$, "OFF"
- END IF
-
- IF InstallHelpFiles <> 0 THEN
- AddListItem FileSections$, "HelpFiles"
- AddListItem CHECKSTATES$, "ON"
- ELSE
- AddListItem FileSections$, ""
- AddListItem CHECKSTATES$, "OFF"
- END IF
-
- IF RemoveFilesSection <> 0 THEN
- AddListItem FileSections$, "RemoveFiles"
- ELSE
- AddListItem FileSections$, ""
- END IF
-
-
-
- ''' NOTE: always go to max: this blanks out those variables
- FOR i% = 1 TO 4 STEP 1
- AddListItem STATUSTEXT$, ""
- NEXT i%
- FOR i% = 1 TO 7 STEP 1
- AddListItem DRIVETEXT$, ""
- NEXT i%
- ReplaceListItem DRIVETEXT$, 7, DEST$
-
- ''Disk cost list symbols
- APPNEEDS$ = "AppNeeds"
- LessonsNeed$ = "LessonsNeed"
- ExamplesNeed$ = "ExamplesNeed"
- HelpNeeds$ = "HelpNeeds"
- EXTRACOSTS$ = "ExtraCosts"
- BIGLIST$ = "BigList"
- FOR i% = 1 TO 4 STEP 1
- AddListItem BIGLIST$, ""
- NEXT i%
- FOR i% = 1 TO 26 STEP 1
- AddListItem EXTRACOSTS$, "0"
- NEXT i%
-
- ''File Option Variables
-
- RecalcPath
- SetDriveStatus
-
- '''$IFDEF DEBUG
- ''' i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- '''$ENDIF ''DEBUG
-
-
- WELCOME:
- sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- GOTO INSTALL
- ELSEIF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- GOTO WELCOME
- ELSE '''chose customize
- UIPop 1
- END IF
-
-
- CUSTINST:
- sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- ''Install only if it will fit.
- FOR i% = 1 TO 4 STEP 1
- IF GetListItem(BIGLIST$, i%) <> "" THEN
- GOSUB TOOBIG
- GOTO CUSTINST
- END IF
- NEXT i%
- UIPop 1
- GOTO INSTALL
- ELSEIF sz$ = "PATH" THEN
- GOTO GETPATH
- ELSEIF sz$ = "CHK1" THEN
- RecalcOptFiles AppFiles
- SetDriveStatus
- GOTO CUSTINST
- ELSEIF sz$ = "CHK2" THEN
- RecalcOptFiles ExampleFiles
- SetDriveStatus
- GOTO CUSTINST
- ELSEIF sz$ = "CHK3" THEN
- RecalcOptFiles LessonFiles
- SetDriveStatus
- GOTO CUSTINST
- ELSEIF sz$ = "CHK4" THEN
- RecalcOptFiles HelpFiles
- SetDriveStatus
- GOTO CUSTINST
- ELSEIF sz$ = "REACTIVATE" THEN
- RecalcPath
- SetDriveStatus
- GOTO CUSTINST
- ELSE
- GOSUB ASKQUIT
- GOTO CUSTINST
- END IF
-
-
-
- INSTALL:
-
- FOR i% = 1 TO 4 STEP 1
- IF GetListItem(CHECKSTATES$, i%) <> "OFF" THEN
- GOTO CONTINUEINSTALL
- END IF
- NEXT i%
-
- ''' if here, nothing was checked for copying, so tell the user & give option to return to custinst or blow
- GOTO NOFILES
-
- CONTINUEINSTALL:
-
- CursorSave% = ShowWaitCursor()
- ClearCopyList
- '''NOTE: these constants ok to send, regardless if the sections exist... addoptfiles will check for section valididty
- AddOptFilesToCopyList AppFiles
- AddOptFilesToCopyList LessonFiles
- AddOptFilesToCopyList ExampleFiles
- AddOptFilesToCopyList HelpFiles
- AddOptFilesToCopyList RemoveFiles
-
- CreateDir DEST$, cmoNone
- CopyFilesInCopyList
- '''RemoveFile MakePath(DEST$, "fsch.prf"), cmoForce
-
- CreateProgmanGroup FTS, "", cmoNone
-
- IF GetListItem(CHECKSTATES$, AppFiles) = "ON" THEN
- CreateProgmanItem FTS, FTS, MakePath(DEST$, "FSCH.EXE"), DEST$+"\FTSICON.ICO", cmoOverwrite
- END IF
-
- IF GetListItem(CHECKSTATES$, HelpFiles) = "ON" THEN
- CreateProgmanItem FTS, "FTS Help", "winhelp.exe "+MakePath(DEST$,HELPFILENAME), DEST$+"\FTHLPICN.ICO", cmoOverwrite
- END IF
-
- ShowProgmanGroup FTS, 1, cmoNone
- RestoreCursor CursorSave%
-
- SUCCESSFULEXIT:
- sz$ = UIStartDlg(CUIDLL$, XSUCCESS, "FInfoDlgProc", APPHELP, HELPPROC$)
- IF sz$ <> "EXIT" THEN
- GOTO SUCCESSFULEXIT
- ELSE '''chose customize
- UIPop 1
- END IF
-
-
- QUIT:
- UIPopAll
- END
-
- 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
-
- END
-
- NOFILES:
- sz$ = UIStartDlg(CUIDLL$, NOFILESSELD, "FInfoDlgProc", 0, "")
- IF sz$ = "BACK" THEN
- UIPop 1
- GOTO CUSTINST
- ELSE
- GOTO QUIT
- END IF
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources were corrupted, AEC Tech Support.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
-
-
- GETPATH:
- OLDDEST$ = DEST$
- 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
- GOSUB BADPATH
- DEST$ = OLDDEST$
- 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
-
-
-
- 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
-
-
-
- '**
- '** Purpose:
- '** Adds the specified option files to the copy list.
- '** Arguments:
- '** ftype% - type of files to add, one of the following:
- '** Returns:
- '** none.
- '*************************************************************************
- SUB AddOptFilesToCopyList (ftype%) STATIC
-
- IF ftype% = LessonFiles THEN
- IF InstallLessonFiles THEN
- IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
- CreateDir DEST$+"\LESSONS", cmoNone
- RealDest$ = DEST$+"\LESSONS"
- END IF
- END IF
- ELSE
- RealDest$ = DEST$
- END IF
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- SectionName$ = GetListItem(FileSections$, ftype%)
-
- IF ftype% = RemoveFiles THEN
- IF RemoveFilesSection <> 0 THEN
- AddSectionFilesToCopyList SectionName$, SrcDir$, RealDest$
- END IF
- ELSEIF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
- AddSectionFilesToCopyList SectionName$, SrcDir$, RealDest$
- END IF
-
- SrcDir$ = ""
-
- 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, ExampleFiles, LessonFiles, HelpFiles
- '** Returns:
- '** none.
- '*************************************************************************
- SUB RecalcOptFiles (ftype%) STATIC
- CursorSave% = ShowWaitCursor()
- ClearCopyList
- AddOptFilesToCopyList ftype%
-
- fExtra% = 0
- IF ftype% = AppFiles THEN
- ListSym$ = APPNEEDS$
- IF GetListItem(CHECKSTATES$, AppFiles) = "ON" THEN
- ''Add extra cost to Windows drive for ini/progman, etc.
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
- ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
- fExtra% = 1
- END IF
- ELSEIF ftype% = LessonFiles THEN
- ListSym$ = LessonsNeed$
- ELSEIF ftype% = ExampleFiles THEN
- ListSym$ = ExamplesNeed$
- ELSEIF ftype% = HelpFiles THEN
- ListSym$ = HelpNeeds$
- END IF
-
- StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
-
- cost& = 0
- FOR i% = 1 TO 26 STEP 1
- cost& = cost& + VAL(GetListItem(ListSym$, i%))
- NEXT i%
- ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
-
- IF StillNeed& > 0 THEN
- ReplaceListItem BIGLIST$, ftype%, "YES"
- ELSE
- ReplaceListItem BIGLIST$, ftype%, ""
- END IF
-
- IF fExtra% THEN
- ReplaceListItem EXTRACOSTS$, ndrive%, "0"
- 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 LessonFiles
- RecalcOptFiles ExampleFiles
- RecalcOptFiles HelpFiles
-
- 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& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(LessonsNeed$, ndrive%)) + VAL(GetListItem(ExamplesNeed$, ndrive%)) + VAL(GetListItem(HelpNeeds$, ndrive%))
- free& = GetFreeSpaceForDrive(drive$)
- ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
- ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
- ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
-
- IF drive$ = WINDRIVE$ THEN
- ReplaceListItem DRIVETEXT$, 4, ""
- ReplaceListItem DRIVETEXT$, 5, ""
- ReplaceListItem DRIVETEXT$, 6, ""
- ELSE
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
- cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(LessonsNeed$, ndrive%)) + VAL(GetListItem(ExamplesNeed$, ndrive%)) + VAL(GetListItem(HelpNeeds$, ndrive%))
- IF cost& = 0 THEN
- ReplaceListItem DRIVETEXT$, 4, ""
- ReplaceListItem DRIVETEXT$, 5, ""
- ReplaceListItem DRIVETEXT$, 6, ""
- ELSE
- free& = GetFreeSpaceForDrive(WINDRIVE$)
- ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
- ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
- ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
- END IF
- END IF
- 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
-
-