home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* AnyTime for Windows Setup Script
- '**************************************************************************
-
- '' Define DEBUG for script debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST WELCOME = 100
- CONST ASKVER = 110
- CONST UPGVER = 120
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST EXITFAILURE = 400
- CONST EXITQUIT = 600
- CONST EXITSUCCESS = 700
- CONST WHICHHOLI = 810
- CONST APPHELP = 900
- CONST SETOWNER = 1000
- CONST INSTALLDRV = 1200
- CONST WAITDLG = 1400
- CONST EXITREBOOT = 1500
- CONST BBD1 = 5050
- 'CONST BBD6 = 5000
- CONST CUSTINST = 6200
- CONST TOOBIG = 6300
- CONST BADPATH = 6400
-
- '' For message boxes
- CONST MB_YESNO=4
- CONST IDNO=7
- CONST IDYES=6
-
- DIM INSTL%(8) ''EUB
- DIM HOLIDAYS$(8) ''EUB
-
- ''Bitmap ID
- CONST LOGO = 1
-
- ''File Types
- CONST BASEFILES = 1
-
- ''Install directories, etc.
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL WINDRIVE$ ''Windows drive letter.
- GLOBAL CUIDLL$ ''CUI DLL
- GLOBAL WINDIR$ ''Windows directory
- GLOBAL SYSDIR$ ''System directory
- GLOBAL WININI$ ''"win.ini"
- GLOBAL SYSINI$ ''GetWindowsDir() + "system.ini"
- GLOBAL CDDRV$ ''EUB - CDROM drive root directory
- GLOBAL ATWINI$
- GLOBAL STAMP$
-
- '' User info
- GLOBAL OWNER$ '' Product registered owner
- GLOBAL SERIALNUM$ '' Was WORKPLACE$ :Company or such
- GLOBAL GROUP$
-
- ''Install item lists
- GLOBAL BASE$ ''List of base files
- GLOBAL BASEINST$ ''List of base files to install (subset of BASE$)
-
- ''Custom Install list symbol names
- GLOBAL BASENEEDS$ ''Option list costs per drive
- GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
-
- ''Custom Install dialog list symbol names
- GLOBAL CHECKSTATES$ ''List of check box values
- GLOBAL STATUSTEXT$ ''List of values to initialize status items
- GLOBAL DRIVETEXT$ ''Drive space info, etc.
-
- '' Customize product
- GLOBAL CUSTOMIZE%
-
- GLOBAL STAMPLEN ''EUB
- GLOBAL ATWFOUND%
- GLOBAL CUSTINSTALL%
-
- '' Which type of install to perform, by default
- GLOBAL DEFINSTOPT$
-
- ''Progman titles
- GLOBAL ATWAPP$ ''Name of ATW app
-
-
- ''Win.ini [AnyTime for Windows] install code
- GLOBAL INSTDIR$
-
- ''Space requirements
- GLOBAL FITS% '' > 0 if everything fits
-
- DECLARE SUB RecalcOptFiles (ftype%)
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- DECLARE FUNCTION GetWindowsVersionCorrectly& ()
- DECLARE FUNCTION MakeVer& (x as integer, y as integer)
- DECLARE FUNCTION StringInList (s$, y$) AS INTEGER
- DECLARE SUB RemoveSectionFiles (dest$, sect$)
- DECLARE SUB RemDirectory (d$)
- DECLARE SUB SendProgmanCommand LIB "CUI.DLL" (s$)
-
- '' These are defined in atw.inc (product-specific)
- DECLARE SUB SetProductTitles
- DECLARE FUNCTION InfFile() AS STRING
- DECLARE FUNCTION MakeInstDir(D$) AS STRING
- DECLARE SUB AddInfSectionNames (BASE$, BASEINST$)
- DECLARE SUB RecalcPath
- DECLARE SUB AddOptFilesToCopyList (ftype%)
- DECLARE SUB SetDriveStatus
- DECLARE SUB AddOptFiles
- DECLARE SUB ConfigureApps
- DECLARE SUB AddBillboards
- DECLARE SUB DoUninstall
-
- '' the function that reads the SN.DAT file and stamps the .DLL
- Declare Function StampSNDAT Lib "RSTAMP.DLL" (lpDLL$,lpSNDAT$,nResID%) As Integer
- Declare Function StampCurrentTimeDate Lib "RSTAMP.DLL" (lpzFile$,nResID%) As Integer
- Declare Function SetHandleCount Lib "Kernel.DLL" (cHandles%) As Integer
- Declare Function ShowWindow Lib "USER.EXE" (WHnd%,STATE%) As Integer
- dkw% = SetHandleCount (60)
- dkw% = ShowWindow (MAINWIN%, STATE%)
- '' Include product-specific function definitions
- '$INCLUDE 'specific.inc'
-
-
-
- '' This is where it all begins!
-
- INIT:
-
- CUIDLL$ = "cui.dll"
- CUSTOMIZE% = -1
- DEFINSTOPT$ = "2" '' "1" = 1st radiobutton selection, "2"=2nd, "3"=3rd
- CDDRV$ = GetSymbolValue("STF_SRCDIR") ''EUB - Intallation drive root directory
-
- SetProductTitles
- STATE%=3
- MAINWIN%=HwndFrame()
- dkw%=ShowWindow (MAINWIN%, STATE%)
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- SetBitmap CUIDLL$, LOGO
-
-
- '' We don't do Windows 3.0...
-
- If GetWindowsVersionCorrectly() < MakeVer(3, 10) Then
- i% = DoMsgBox("This product requires Windows version 3.10 or greater", ATWAPP$, MB_OK)
- GOTO DONEFINIFIN
- End If
-
-
-
-
- ''Find location of INF file and create a default dest. dir
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + InfFile()
- END IF
-
- '' Load the INF file
- ReadInfFile szInf$
-
- '' Construct default strings
- WINDIR$ = GetWindowsDir()
- SYSDIR$ = GetWindowsSysDir()
- WININI$ = "win.ini"
- SYSINI$ = MakePath(WINDIR$, "system.ini")
- GROUP$ = "AnyTime for Windows"
-
- '' Construct the default install path
- WINDRIVE$ = MID$(WINDIR$, 1, 1)
- DEST$ = MakeInstDir(WINDRIVE$)
-
- '' Setup install symbols
- '' BASE$ = "Base Files"
- BASE$ = "Files"
- BASEINST$ = "Base Files Inst"
-
- SetSymbolValue BASE$, ""
-
- ''Set up symbols for the initial install dialog
- RADIODEFAULT$ = "Radio Default"
-
- ''Set up symbols for the custom install dialog
- CHECKSTATES$ = "CheckItemsState"
- STATUSTEXT$ = "StatusItemsText"
- DRIVETEXT$ = "DriveStatusText"
-
- AddListItem CHECKSTATES$, "ON"
- FOR i% = 2 TO 8 STEP 1
- AddListItem CHECKSTATES$, "OFF"
- NEXT i%
-
- FOR i% = 1 TO 8 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
- BASENEEDS$ = "BaseNeeds"
-
- ''--------Initialize flags
- CUSTINSTALL% = 1
-
- '' INSTL%(1) = 1 ''U.S. Holidays
- FOR i% = 1 TO 8 STEP 1
- INSTL%(i%) = 0 ''holiday files 0=don't installed; 1=install
- NEXT i%
-
- HOLIDAYS$(1) = "Holidays"
- HOLIDAYS$(2) = "UK"
- HOLIDAYS$(3) = "Canada"
- HOLIDAYS$(4) = "France"
- HOLIDAYS$(5) = "Italy"
- HOLIDAYS$(6) = "Spain"
- HOLIDAYS$(7) = "German"
- HOLIDAYS$(8) = "Benelux"
- ''------------------------
-
- ''Configure lists of installable files
- AddInfSectionNames BASE$, BASEINST$
-
- '$IFDEF DEBUG
- i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- '$ENDIF ''DEBUG
-
-
- '' Display Welcome dialog
- WELCOME:
-
- sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- ELSEIF sz$ = "CONTINUE" THEN
- UIPop 1
- GOTO CUSTOMIZE
- END IF
- GOTO WELCOME
-
-
- '' Customize the copy of the product
- CUSTOMIZE:
- IF NOT CUSTOMIZE% THEN
- GOTO DOINST
- END IF
-
- sz$ = UIStartDlg(CUIDLL$, SETOWNER, "FNameOrgDlgProc", 0, "")
-
- IF sz$ = "EXIT" THEN
- UIPop 1
- GOSUB ASKQUIT
- GOTO CUSTOMIZE
- ELSEIF sz$ = "CONTINUE" THEN
- OWNER$ = GetSymbolValue("NameOut")
- IF OWNER$ = "" THEN
- i% = DoMsgBox("Please enter your name before continuing.", "AnyTime for Windows Install", MB_OK)
- GOTO CUSTOMIZE
- END IF
- SERIALNUM$ = "00000000000000000000"
- SNDAT$ = MakePath(CDDRV$,"SN.DAT")
- IF DoesFileExist(SNDAT$,femExists) THEN
- OPEN MakePath(CDDRV$,"SN.DAT") FOR INPUT AS #1
- LINE INPUT #1,SERIALNUM$
- CLOSE #1
- '' i% = DoMsgBox("Serialnum="+SERIALNUM$, "Debugging", MB_OK)
- ELSE
- i% = DoMsgBox("Can't find "+SNDAT$, "AnyTime for Windows Install", MB_OK)
- END IF
-
- ''----Need to check for length of input, perhaps pad with blanks, etc.
- IF LEN(OWNER$) >=30 THEN
- OWNER$ = MID$(OWNER$,1,30) + CHR$(0)
- ELSE
- OWNER$ = OWNER$ + CHR$(0)
- END IF
- SERIALNUM$ = MID$(SERIALNUM$,1,12) + CHR$(0)
- STAMP$ = CHR$(LEN(OWNER$)) + OWNER$ + CHR$(LEN(SERIALNUM$)) + SERIALNUM$
- STAMPLEN = LEN(STAMP$)
- '' i% = DoMsgBox("STAMPLEN="+STR$(STAMPLEN), "Debugging", MB_OK)
- UIPop 1
- GOTO GETDEFINSTPATH
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO WELCOME
- END IF
- GOTO CUSTOMIZE
-
-
- '' See which install user wants
- WHICHINST:
- sz$ = UIStartDlg(CUIDLL$, WHICHHOLI, "FCustInstDlgProc", 0, "") ''EUB
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- IF CUSTINSTALL% THEN
- GOTO CUSTINST
- ELSE
- GOTO INSTALL
- END IF
- ELSEIF sz$ = "EXIT" THEN
- UIPop 1
- GOSUB ASKQUIT
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO GETDEFINSTPATH
- ELSEIF sz$ = "CHK1" THEN
- CUSTINSTALL% = 1 - CUSTINSTALL%
- END IF
- GOTO WHICHINST
-
-
- DOINST:
-
- GETDEFINSTPATH:
- GOSUB GETPATH
- ATWINI$ = MakePath(DEST$, "ANYTIME.INI") ''EUB
-
- IF sz$ = "CONTINUE" THEN
- ''Install only if it will fit.
- IF FITS% > 0 THEN
- GOSUB TOOBIG
- GOTO GETDEFINSTPATH
- END IF
-
- UIPop 1
- GOTO WHICHINST
-
- ELSEIF sz$ = "BACK" THEN
- GOTO CUSTOMIZE
- END IF
- GOTO GETDEFINSTPATH
-
-
- ''Perform a custom installation (let user choose files, etc)
- CUSTINST:
- '' RecalcPath
- '' SetDriveStatus
-
- CUSTINSTDLG:
- sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", 0, "") ''EUB
-
- HOLI% = 0
-
- IF sz$ = "CONTINUE" THEN
- ''Install only if it will fit.
- IF FITS% > 0 THEN
- GOSUB TOOBIG
- GOTO CUSTINSTDLG
- END IF
- UIPop 1
- GOTO INSTALL
- ELSEIF sz$ = "CHK1" THEN
- HOLI% = 1
- ''--------------------------------
- ELSEIF sz$ = "CHK2" THEN
- HOLI% = 2
- ELSEIF sz$ = "CHK3" THEN
- HOLI% = 3
- ELSEIF sz$ = "CHK4" THEN
- HOLI% = 4
- ELSEIF sz$ = "CHK5" THEN
- HOLI% = 5
- ELSEIF sz$ = "CHK6" THEN
- HOLI% = 6
- ELSEIF sz$ = "CHK7" THEN
- HOLI% = 7
- ELSEIF sz$ = "CHK8" THEN
- HOLI% = 8
- ''--------------------------------
- ELSEIF sz$ = "EXIT" THEN
- IF CUSTINSTALL% THEN
- UIPop 1
- END IF
- GOSUB ASKQUIT
- GOTO CUSTINST
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO WHICHINST
- END IF
-
- IF HOLI% > 0 THEN
- INSTL%(HOLI%) = 1-INSTL%(HOLI%)
- ''--- j% = DoMsgBox("INSTL%(" + STR$(HOLI%)+")="+STR$(INSTL%(HOLI%)), "Debugging", MB_OK)
- END IF
-
- GOTO CUSTINSTDLG
-
-
- INSTALL:
- RecalcPath
- SetDriveStatus
-
- SetRestartDir DEST$
- ClearCopyList
-
- ''NOTE: CHECKSTATES$ 1 (i.e. BASEFILES=1) is used for installing
- '' ANYTIME files. However, it is also used for the first holiday
- '' option box, which when unchecked by the user is interpreted by
- '' routine AddOptFiles to bypass the installations of the ANYTIME
- '' files. So, the state is reset here to ON.
- ReplaceListItem CHECKSTATES$,BASEFILES,"ON" ''EUB-reset to ON
-
- AddOptFiles
-
- AddBillboards
-
- BACKLASH:
- IF (MID$(DEST$, (LEN(DEST$)), 1)) = "\" THEN
- DEST$ = MID$(DEST$, 1, (LEN(DEST$)-1))
- GOTO BACKLASH
- END IF
-
-
- CreateDir DEST$, cmoNone
-
- UIPopAll
-
- ''Do the copyn'
- SetCopyGaugePosition 10, 135
- CopyFilesInCopyList
-
- ''Back up SYSTEM.INI and WIN.INI
- CopyFile MakePath(WINDIR$, WININI$), MakePath(WINDIR$, "WIN.BAK"), cmoOverwrite, 0
- CopyFile SYSINI$, MakePath(WINDIR$, "SYSTEM.BAK"), cmoOverwrite, 0
-
- '' Configure the installed applications
-
-
- SERIALNUM$ = "00000000000000000000"
- SNDAT$ = MakePath(CDDRV$,"SN.DAT")
- IF DoesFileExist(SNDAT$,femExists) THEN
- OPEN MakePath(CDDRV$,"SN.DAT") FOR INPUT AS #1
- LINE INPUT #1,SERIALNUM$
- CLOSE #1
- StampLine2$ = "Please record this number on your Registration Card and in your "+ATWAPP$+" Manual."
- '' i% = DoMsgBox("Your "+ATWAPP$+" Serial Number is "+SERIALNUM$+". "+StampLine2$, ATWAPP$+" Install", MB_OK)
- ELSE
- i% = DoMsgBox("Can't find "+SNDAT$, "AnyTime for Windows Install", MB_OK)
- END IF
-
-
-
- '' IF DoesFileExist(ATWINI$,femExists) THEN
- ''-- CopyFile ATWINI$, MakePath(DEST$, "ANYINI.OLD"), cmoOverwrite, 0
- '' RemoveFile ATWINI$, cmoNone
- '' END IF
-
- NC% = 1
- FOR i% = 1 to 8 STEP 1
- IF INSTL%(i%) = 1 THEN ''1=TRUE: Set ANYTIME.INI entry
- N$ = MID$( STR$(NC%), 2, LEN( STR$(NC%) ) -1 )
- FKEY$ = "FILE"+N$
- HFILE$ = HOLIDAYS$(i%)+".atw"
- CreateIniKeyValue ATWINI$, "AttachedFiles", FKEY$, DEST$+"\"+HFILE$, cmoOverwrite
- NC% = NC% + 1
- END IF
- NEXT i%
-
- '' All boxes were uncheckecked & file was not created: Create defaults
- IF NC% = 0 THEN
- CreateIniKeyValue ATWINI$, "AttachedFiles", "", "", cmoOverwrite
- END IF
-
-
- IF DoesFileExist (ATWINI$,femExist)=1 THEN
- CopyFile ATWINI$, MakePath(DEST$, "ANYTIME.BAK"), cmoOverwrite, 0
-
- CopyFile (MakePath(DEST$,"ANYTIME.INI")),GetWindowsDir+"ANYTIME.INI", cmoNone, 0
- RemoveFile MakePath(DEST$,"ANYTIME.INI"), cmoNone
- '' DelFileStat%=1
-
- END IF
-
-
- IF VER&=1 THEN
-
- DelFileStat%=0
- IF DoesFileExist (MakePath(DEST$,"D7P0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"D7P0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"D7L0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"D7L0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"TD7P0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"TD7P0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"TD7L0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"TD7L0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M14L0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M14L0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M14P0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M14P0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M14P1.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M14P1.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M14P2.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M14P2.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M14L1.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M14L1.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M41L0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M41L0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"M41L1.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"M41L1.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"TM41L0.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"TM41L0.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DoesFileExist (MakePath(DEST$,"TM41L1.CDF"),femExist)=1 THEN
- RemoveFile MakePath(DEST$,"TM41L1.CDF"), cmoNone
- DelFileStat%=1
- ELSE
- ENDIF
-
- IF DelFileStat%=1 THEN
- MESS1$="New versions of the Event Multi-Day Planner, 12-Month Calendar, and 6-Month Glance layouts have been installed."
- i% = DoMsgBox(MESS1$+" The options for these layouts have been reset to their default settings.", ATWAPP$, MB_OK)
- ELSE
- END IF
-
- END IF
-
- ConfigureApps
-
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- dlg% = EXITREBOOT
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSE
-
- '$IFNDEF DEBUG
- RESUME NEXT
- '$ELSE
- dlg% = EXITFAILURE
- '$ENDIF
-
- END IF
-
- QUITL1:
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
- UIPop 1
-
- DONEFINIFIN:
- END
-
- ERRQUIT:
- i% = DoMsgBox("An error occured during installation. Please call Individual Software Customer Service at (800) 331-3313.", "Setup Error", 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.
- VALPATH:
- IF (MID$(DEST$, (LEN(DEST$)), 1)) = "\" THEN
- DEST$ = MID$(DEST$, 1, (LEN(DEST$)-1))
- GOTO VALPATH
- END IF
-
- '' IF IsDirWritable(CDDRV$) <> 1 THEN
- '' i% = DoMsgBox("Install has detected that the AnyTime diskette is write-protected.", APP$, MB_OK)
- '' i% = DoMsgBox("Please remove the write-protection and select OK.", APP$, MB_OK)
- '' GOTO VALPATH
- '' END IF
-
-
- IF (MID$(DEST$, 2, 1)) <> ":" THEN
- i% = DoMsgBox("This is not a valid path. Please enter a different path.", APP$, MB_OK)
- GOTO GETPATHL1
- END IF
-
-
- IF (MID$(DEST$, 3, 1)) <> "\" THEN
- i% = DoMsgBox("This is not a valid path. Please enter a different path.", APP$, MB_OK)
- GOTO GETPATHL1
- END IF
-
-
- Ver&=0
-
- IF DoesFileExist (MakePath(DEST$,"ATWRES.DLL"),femExist)=1 THEN
- OldATWVer$=GetVersionOfFile (MakePath(DEST$,"ATWRES.DLL"))
- VerField1&=GetVersionNthField (OldATWVer$,1)*1000
- VerField2&=GetVersionNthField (OldATWVer$,2)*100
- VerField3&=GetVersionNthField (OldATWVer$,3)*10
- VerField4&=GetVersionNthField (OldATWVer$,4)
-
- OldATWVerVal&=VerField1& + VerField2& + VerField3& + VerField4&
-
- '' i% = DoMsgBox("Old Version = " + OldATWVer$, APP$, MB_OK)
- '' i% = DoMsgBox("Old Version Val = " + STR$(OldATWVerVal&), APP$, MB_OK)
- '' i% = DoMsgBox("Old Version Val = " + STR$(NewATWVerVal&), APP$, MB_OK)
-
- IF OldATWVerVal&>NewATWVerVal& Then
- Ver&=1
-
- ELSEIF OldATWVerVal&=NewATWVerVal& Then
- Ver&=2
-
- ELSEIF OldATWVerVal&<NewATWVerVal& Then
- Ver&=3
-
- END IF
- END IF
-
- IF Ver&=1 THEN
- sz$ = UIStartDlg(CUIDLL$, ASKVER, "FInfoDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO GETPATHL1
- END IF
-
- ELSEIF Ver&=3 THEN
- sz$ = UIStartDlg(CUIDLL$, UPGVER, "FInfoDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO GETPATHL1
- END IF
-
- END IF
-
-
-
-
- IF NETINSTALL%=0 THEN
- IF IsDriveNetwork(MID$(DEST$, 1, 1)) > 0 THEN
- i% = DoMsgBox("This single user version will not install on or run from a network drive.", APP$, MB_OK)
- i% = DoMsgBox("Please select a local hard disk or contact Individual Software Customer Service at (800) 822-3522.", APP$, MB_OK)
- GOTO GETPATHL1
- END IF
- END IF
-
- IF IsDriveRemovable(DEST$) > 0 THEN
- i% = DoMsgBox("This program must be installed to a hard drive. Please enter a different drive.", APP$, MB_OK)
- GOTO GETPATHL1
- END IF
-
- IF DEST$+"\"=GetWindowsSysDir THEN
- i% = DoMsgBox("This program can not be installed into the Windows System directory. Please enter a different path.", APP$, MB_OK)
- GOTO GETPATHL1
- END IF
-
- IF DEST$+"\"=GetWindowsDir THEN
- i% = DoMsgBox("This program can not be installed into the Windows directory. Please enter a different path.", APP$, MB_OK)
- 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$ = ""
-
- RETURN
- ELSEIF sz$ = "EXIT" THEN
- UIPop 1
- GOSUB ASKQUIT
- GOTO GETPATHL1
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- RETURN
- END IF
- GOTO GETPATHL1
-
-
- TOOBIG:
- sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
- UIPop 1
- RETURN
-
-
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- UIPop 1
- RETURN
-
-
- ASKQUIT:
- sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
-
- IF sz$ = "EXIT" THEN
- UIPopAll
- ERROR STFQUIT
- ELSE
- UIPop 1
- END IF
- RETURN
-
-
- ''Recalculate space based on install options...
- SUB RecalcOptFiles (ftype%) STATIC
-
- CursorSave% = ShowWaitCursor()
-
- sz$ = UIStartDlg(CUIDLL$, WAITDLG, "FModelessDlgProc", APPHELP, HELPPROC$)
-
- SLEEP 1
-
- ClearCopyList
-
- UIPop 1
-
- ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
- RestoreCursor CursorSave%
-
- ListSym$ = ""
- END SUB
-
-
- ''Make path from dir and szFile; add \ as needed
- 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
-
-
- '' Return true if the given string is in the symbol's list
- FUNCTION StringInList (s$, y$) STATIC AS INTEGER
- l% = GetListLength(y$)
- FOR i% = 1 TO l
- IF s$ = GetListItem(y$, i%) THEN
- StringInList = -1
- GOTO DONE
- END IF
- NEXT i%
- StringInList = 0
- DONE:
- END FUNCTION
-
-
- ''Get Windows version
- FUNCTION GetWindowsVersionCorrectly& () STATIC
- GetWindowsVersionCorrectly = GetWindowsMajorVersion() * 256 + GetWindowsMinorVersion()
- END FUNCTION
-
-
- '' Turn x, y into a major.minor version long
- FUNCTION MakeVer& (x as integer, y as integer) STATIC
- MakeVer = x * 256 + y
- END FUNCTION
-
-
- '' Remove all files in the given .INF section
- SUB RemoveSectionFiles (dest$, sect$) STATIC
- foo$ = "foo"
- MakeListFromSectionFilename foo$, sect$
- l% = GetListLength(foo$)
- FOR i% = 1 TO l% STEP 1
- RemoveFile MakePath(dest$, GetListItem(foo$, i%)), cmoForce
- NEXT i%
- foo$ = ""
- END SUB
-
-
- '' Remove directory and all files in it, if it exists
- SUB RemDirectory(d$) STATIC
- IF Exists(MakePath(d$, "NUL")) THEN
- Kill MakePath(d$, "*.*")
- RmDir d$
- END IF
- END SUB
-
-
-
-