home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Rangers Print Kit
/
PRINTKIT.BIN
/
pc
/
prprint.ms_
/
prprint.ms
Wrap
Text File
|
1995-10-10
|
9KB
|
303 lines
title$ = "The Mighty Morphin Power Rangers Print Kit Setup Program"
ini$ = "SABAN.INI" ''Ezt a file-t a Windows directory-ba csinalja
section$ = "power_ranger_print_kit" ''Az ini$ beli szekcio neve
cd_dir$ = "\RESOURCE" ''A CD_DIR valtozo kezdoerteke lesz az ini$ file-ban
SABAN$ = "C:\SABAN" ''Ezt ajanlja fel jobb hijjan celutvonalnak + appl$
group$ = "Saban Software" ''Ez lesz a Program Manager Group neve
item$ = "Power Rangers Print Kit" ''Program Manager Icon alairas
appl$ = "PRPRINT" ''.INF, .ICO, .EXE file neve
develop$ = "EXE\" ''Relativ utvonal a setup szulejetol az .exe file-hoz
final$ = "EXE\" ''Relativ utvonal a setup-tol az .exe file-hoz
CUIDLL$ = "PRPRINT.DLL"
DECLARE SUB DeleteDir LIB "PRPRINT.DLL" (Path$)
DECLARE FUNCTION GetFileVersion LIB "PRPRINT.DLL" (Path$) AS LONG
DECLARE FUNCTION DeleteProgmanItem LIB "PRPRINT.DLL" (hwnd%,Group$,Item$) AS LONG
DECLARE FUNCTION DeleteProgmanGroup LIB "PRPRINT.DLL" (hwnd%,Group$) AS LONG
''$DEFINE QTW ''Install Quick Time Movie
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST NOQUICKTIME = 810
CONST OLDQUICKTIME = 820
CONST APPHELP = 900
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST LOGOBITMAP = 1
GLOBAL EXTRACOSTS$
GLOBAL APPNEEDS$
GLOBAL cost&
GLOBAL free&
DECLARE FUNCTION CheckForSpace(Path$) AS INTEGER
DECLARE FUNCTION GetWindowLong LIB "user" (hwnd%,offs%) AS LONG
DECLARE FUNCTION SetWindowLong LIB "user" (hwnd%,offs%,value&) AS LONG
DECLARE SUB GetWindowRect LIB "user" (hwnd%,rect AS POINTER TO INTEGER)
DECLARE FUNCTION SetWindowPos LIB "user" (hwnd%,hafter%,x%,y%,w%,h%,f%) AS INTEGER
INIT:
APPNEEDS$ = "AppNeeds"
EXTRACOSTS$ = "ExtraCosts"
ini$ = GetWindowsDir + ini$
SetBitmap CUIDLL$, LOGOBITMAP
SetTitle title$
hwnd% = HwndFrame()
style& = GetWindowLong(hwnd%,-16)
DIM rect(4) AS INTEGER
GetWindowRect hwnd%, VARPTR(rect(0))
rect(2) = rect(2) - rect(0)
rect(3) = rect(3) - rect(1)
SRC$ = GetSymbolValue("STF_SRCDIR")
IF (LEN(SRC$) > 8) THEN
IF (MID$(SRC$,LEN(SRC$)-6,7) = "\SETUP\") THEN
SRC$ = MID$(SRC$,1,LEN(SRC$)-6) + develop$
ELSE
SRC$ = SRC$ + final$
END IF
ELSE
SRC$ = SRC$ + final$
END IF
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + appl$ + ".INF"
END IF
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
sz$ = GetIniKeyString(ini$,group$,"PATH")
sectnum% = VAL(GetIniKeyString(ini$,group$,"SectionNumber"))
IF sz$ <> "" THEN
SABAN$ = sz$
ENDIF
sz$ = GetIniKeyString(ini$,section$,"HD_DIR")
IF sz$ = "" THEN
DEST$ = SABAN$ + "\" + appl$
sectnum% = sectnum% + 1
ELSE
DEST$ = sz$
ENDIF
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
IF sz$ = "BACK" THEN ''Uninstall
UIPop 1
GOTO UNINSTALL
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
END IF
'$IFDEF QTW
qtim$ = GetWindowsSysDir + "QTIM.DLL"
IF DoesFileExist(qtim$,femExists) THEN
IF GetFileVersion(qtim$) < &H2000333 THEN
qtver% = OLDQUICKTIME
ELSE
qtver% = 0
END IF
ELSE
qtver% = NOQUICKTIME
END IF
IF qtver% THEN
QUICKTIME:
sz$ = UIStartDlg(CUIDLL$, qtver%, "FInfoDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUICKTIME
END IF
UIPop 1
IF sz$ = "CONTINUE" THEN
UIPop 1
RUN SRC$ + "qtinstal.exe"
END IF
END IF
'$ENDIF
ClearCopyList
ReadInfFile szInf$
GETPATH:
SetSymbolValue "EditTextIn", DEST$
GETPATHL1:
SetSymbolValue "EditFocus", "END"
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = UCASE$(GetSymbolValue("EditTextOut"))
IF sz$ = "CONTINUE" THEN
IF MID$(DEST$, LEN(DEST$), 1) = "\" THEN
DEST$ = MID$(DEST$, 1, LEN(DEST$)-1)
END IF
IF LEN(DEST$) = 0 THEN
DEST$ = "."
END IF
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
AddSectionFilesToCopyList "Files", SRC$, DEST$
IF CheckForSpace(DEST$) = 1 THEN
GOSUB TOOBIG
ClearCopyList
GOTO GETPATHL1
END IF
UIPop 1
CreateDir DEST$, cmoVital
OpenLogFile DEST$ + "\SETUP.LOG", 1
CopyFilesInCopyList
IF GetIniKeyString(ini$,group$,"PATH") = "" THEN
IF INSTR(DEST$,MID$(SABAN$,2)) = 2 THEN
SABAN$ = MID$(DEST$,1,1) + MID$(SABAN$,2)
CreateIniKeyValue ini$, group$, "PATH", SABAN$, cmoAll
END IF
END IF
CreateIniKeyValue ini$, group$, "SectionNumber", STR$(sectnum%), cmoAll
IF GetIniKeyString(ini$,section$,"CD_DIR") <> cd_dir$ THEN
CreateIniKeyValue ini$, section$, "CD_DIR", cd_dir$ , cmoAll
END IF
IF GetIniKeyString(ini$,section$,"HD_DIR") <> DEST$ THEN
CreateIniKeyValue ini$, section$, "HD_DIR", DEST$ , cmoAll
END IF
IF GetIniKeyString(ini$,section$,"USER_DIR") = "" THEN
CreateIniKeyValue ini$, section$, "USER_DIR", DEST$ , cmoAll
END IF
CreateProgmanGroup group$, "", cmoVital
ShowProgmanGroup group$, 1, cmoNone
i% = DeleteProgmanItem(hwnd%,group$,item$)
ShowProgmanGroup group$, 1, cmoNone
CreateProgmanItem group$,item$,SRC$+appl$+".EXE",DEST$+"\"+appl$+".ICO",cmoOverwrite
CloseLogFile
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
END
UNINSTALL:
sz$ = GetIniKeyString(ini$,section$,"HD_DIR")
IF sz$ = "" THEN
i% = DoMsgBox("The installed game not found.", "Uninstall Application", MB_OK+MB_TASKMODAL+64)
GOTO WELCOME
END IF
i% = DoMsgBox("The following subdirectory will be deleted:"+CHR$(13)+" "+DEST$+CHR$(13)+"Are you sure?", "Uninstall Application", 1+MB_TASKMODAL+32)
IF i% <> 1 THEN
GOTO WELCOME
END IF
ClearCopyList
ReadInfFile szInf$
AddSectionFilesToCopyList "Uninstall", SRC$, DEST$
CopyFilesInCopyList
DeleteDir(DEST$)
RemoveIniSection ini$,section$,cmoNone
i% = DeleteProgmanItem(hwnd%,group$,item$)
sectnum% = sectnum% - 1
IF sectnum% > 0 THEN
CreateIniKeyValue ini$,group$,"SectionNumber",STR$(sectnum%),cmoAll
ELSE
sz$ = GetIniKeyString(ini$,group$,"PATH")
i% = DeleteProgmanGroup(hwnd%,group$)
IF sz$ <> "" THEN
DeleteDir(sz$)
END IF
RemoveFile ini$,cmoNone
END IF
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
i% = DoMsgBox("The path entered is not valid.", "Setup Message", MB_OK+MB_TASKMODAL+64)
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
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
i% = DoMsgBox("Still need "+STR$(cost&-free&)+" bytes free space.", "Setup Info", MB_OK+MB_TASKMODAL+64)
UIPop 1
RETURN
FUNCTION CheckForSpace(Path$) STATIC AS INTEGER
ListSym$ = APPNEEDS$
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
drive$ = MID$(Path$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(drive$)
CheckForSpace = 0
IF cost& >= free& THEN
CheckForSpace = 1
END IF
END FUNCTION