home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Innerspace
/
Innerspace.iso
/
SETUP.MST
< prev
next >
Wrap
Text File
|
1994-12-16
|
9KB
|
351 lines
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'mscpydis.inc' ''System
'$INCLUDE 'msdetect.inc' ''Detects Avalilable Disk Space
''Dialog ID's
'CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST CUSTINST = 6200
CONST TOOBIG = 6300
CONST BADPATH = 6400
'' window sizing
CONST WS_VISIBLE = &H10000000
CONST WS_CAPTION = &H00C00000
CONST WS_CLIPCHILDREN = &H02000000
CONST WS_SYSMENU = &H00080000
CONST WS_MINIMIZEBOX = &H00020000
CONST WS_MAXIMIZEBOX = &H00010000
CONST WS_THICKFRAME = &H00040000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED = 3
'' File set to copy
CONST FILEN1 = 1
''Bitmap ID
CONST LOGO = 1
'' CONST ARIS = 2
'' File set symbol names
GLOBAL NEEDS1$
GLOBAL EXTRACOSTS$
GLOBAL BIGLIST$
GLOBAL DRIVETEXT$
GLOBAL INSPCDEST$
GLOBAL WINDRIVE$
GLOBAL GROUP$
GLOBAL ITEM$
GLOBAL EXE$
GLOBAL SRCDIR$
GLOBAL WINDIR$
GLOBAL WINSYSDIR$
GLOBAL SETUPDIR$
DECLARE SUB AddOptFilesToCopyList (ftype%)
DECLARE SUB RecalcOptFiles (ftype%)
DECLARE SUB RecalcPath
DECLARE SUB SetDriveStatus
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%, iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
DECLARE FUNCTION GetCDDrive LIB "CDTSTV3.DLL" AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
'' Initialize window
hWnd% = HwndFrame()
k& = SetWindowLong(hWnd%, GWL_STYLE, WS_CAPTION+WS_VISIBLE+WS_CLIPCHILDREN+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_THICKFRAME)
j% = ShowWindow(hWnd%, SW_SHOWMAXIMIZED)
'' Check Windows Version Number
MajorVer% = GetWindowsMajorVersion()
MinorVer% = GetWindowsMinorVersion()
IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
END IF
SetBitmap CUIDLL$, LOGO
SetTitle "SoftKey InnerSpace"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
SRCDIR$ = GetSymbolValue("STF_SRCDIR")
WINDIR$ = GetWindowsDir()
WINSYSDIR$ = GetWindowsSysDir()
WINDRIVE$ = MID$(WINDIR$, 1, 1)
INSPCDEST$ = WINDRIVE$ + ":\INNERSPC"
EXE$ = "INNERSPC.EXE"
README$ = "README.TXT"
GROUP$ = "InnerSpace"
ITEM$ = "InnerSpace"
SETUPDIR$ = WINDRIVE$ + ":\~msstfqf.t"
'' list symbols
DRIVETEXT$ = "DriveStatusText"
FOR i% = 1 TO 3 STEP 1
AddListItem DRIVETEXT$, ""
NEXT i%
ReplaceListItem DRIVETEXT$, 3, INSPCDEST$
''Disk cost list symbols
NEEDS1$ = "FileNeeds1"
EXTRACOSTS$ = "ExtraCosts"
BIGLIST$ = "BigList"
FOR i% = 1 TO 5 STEP 1
AddListItem BIGLIST$, ""
NEXT i%
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
NEXT i%
SetRestartDir SETUPDIR$
RecalcPath
SetDriveStatus
WELCOME:
'' sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
'' IF sz$ = "CONTINUE" THEN
'' UIPop 1
'' ELSE
'' GOSUB ASKQUIT
'' GOTO WELCOME
'' END IF
CHECKCDROM:
'' CDDrive% = GetCDDrive()
'' IF CDDrive% = -1 THEN
'' i% = DoMsgBox("CD-ROM drive not found", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
'' END
'' END IF
CUSTINST:
sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''Install only if it will fit.
FOR i% = 1 TO 5 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$ = "REACTIVATE" THEN
RecalcPath
SetDriveStatus
GOTO CUSTINST
ELSE
GOSUB ASKQUIT
GOTO CUSTINST
END IF
INSTALL:
ClearCopyList
AddOptFilesToCopyList FILEN1
CreateDir INSPCDEST$, cmoNone
CopyFilesInCopyList
CreateProgmanGroup GROUP$, "", cmoNone
CreateProgmanItem GROUP$, ITEM$, MakePath(INSPCDEST$, EXE$), "", cmoOverwrite
'' CreateProgmanItem GROUP$, ITEM$, MakePath(INSPCDEST$, README$), "", cmoOverwrite
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
IF n% = 1 THEN
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
ELSEIF sz$ = "BACK" THEN
Run MakePath( INSPCDEST$, EXE$), NOWAIT
END IF
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call SoftKey Technical Support", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
'' ERROR STFQUIT
END
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
GETPATH:
SetSymbolValue "EditTextIn", INSPCDEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = INSPCDEST$
INSPCDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(INSPCDEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(INSPCDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 3, MID$(INSPCDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 3, INSPCDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> INSPCDEST$) AND (olddest$ <> INSPCDEST$+"\") AND (olddest$+"\" <> INSPCDEST$) 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
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
SUB RecalcOptFiles (ftype%) STATIC
CursorSave% = ShowWaitCursor()
ClearCopyList
AddOptFilesToCopyList ftype%
fExtra% = 0
ListSym$ = NEEDS1$
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
cost& = 0
FOR i% = 1 TO 26 STEP 1
cost& = cost& + VAL(GetListItem(ListSym$, i%))
NEXT i%
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
SUB RecalcPath STATIC
CursorSave% = ShowWaitCursor()
RecalcOptFiles FILEN1
RestoreCursor CursorSave%
END SUB
SUB SetDriveStatus STATIC
drive$ = MID$(WINDIR$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
drive2$ = MID$(INSPCDEST$, 1, 1)
ndrive2% = ASC(ucase$(drive2$)) - ASC("A") + 1
cost& = VAL(GetListItem(NEEDS1$,ndrive%))
free& = GetFreeSpaceForDrive(drive$)
ReplaceListItem DRIVETEXT$, 1, STR$(cost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 2, STR$(free& / 1024) + " K"
END SUB
SUB AddOptFilesToCopyList (ftype%) STATIC
AddSectionFilesToCopyList "INNERSPC", SRCDIR$, INSPCDEST$
END SUB
REM End Of File