home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 10
/
CDE10.mdf
/
bonus
/
thumbs
/
thumbs.ms_
/
thumbs.bin
Wrap
Text File
|
1995-04-24
|
7KB
|
278 lines
''$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'msregdb.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST USERNAME = 500
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST USERCODE = 1000
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST BADNAME = 6500
''Bitmap ID
CONST LOGO = 1
GLOBAL SYSDIR$
GLOBAL DEST$ ''Default destination directory.
GLOBAL USER$
GLOBAL CODE$
GLOBAL CONTACT$
GLOBAL EXEFILE$
DECLARE SUB Install
DECLARE SUB RegisterDB
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION ShowWindow LIB "USER.EXE" (hwnd%, nShow%) AS INTEGER
CONST SW_SHOWMAXIMIZED = 3
INIT:
CUIDLL$ = "mscuistf.dll"
HELPPROC$ = "FHelpDlgProc"
' CONTACT$ = "Please contact The Thompson Partnership at 01889 564 601"
CONTACT$ = "Please contact Cerious Software "+"(704)529-0200, Fax (704)529-0497, cerious@vnet.net, CIS: 71501,2470"
SetBitmap CUIDLL$, LOGO
SetTitle "ThumbsPlus Setup"
i% = ShowWindow(HwndFrame(), SW_SHOWMAXIMIZED)
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\THUMBS"
SYSDIR$ = GetWindowsSysDir()
IF IsWindowsShared = 1 THEN
IF GetSymbolValue("STF_MODE") <> "ADMIN" THEN
SYSDIR$ = GetWindowsDir()
END IF
END IF
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore)
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "System", SrcDir$, SYSDIR$
IF GetCopyListCost("", "", "") <> 0 THEN
GOSUB TOOBIG
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
GETNAME:
SetSymbolValue "EditTextIn", USER$
SetSymbolValue "EditFocus", "END"
GETNAMEL1:
sz$ = UIStartDlg(CUIDLL$, USERNAME, "FEditDlgProc", APPHELP, HELPPROC$)
USER$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF LEN(USER$) < 6 THEN
GOSUB BADNAME
GOTO GETNAMEL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETNAMEL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETPATH
ELSE
GOSUB ASKQUIT
GOTO GETNAME
ENDIF
GETCODE:
SetSymbolValue "EditTextIn", CODE$
SetSymbolValue "EditFocus", "END"
GETCODEL1:
sz$ = UIStartDlg(CUIDLL$, USERCODE, "FEditDlgProc", APPHELP, HELPPROC$)
CODE$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETCODEL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETNAME
ELSE
GOSUB ASKQUIT
GOTO GETCODE
ENDIF
Install
RegisterDB
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
GOTO CANTINSTALL
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
CANTINSTALL:
i% = DoMsgBox("Setup was unable to install ThumbsPlus. "+CONTACT$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted. "+CONTACT$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
BADNAME:
sz$ = UIStartDlg(CUIDLL$, BADNAME, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADNAME
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
' Performs all installation operations.
SUB Install STATIC
EXEFILE$ = MakePath(DEST$, "thumbs.exe")
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
CopyFilesInCopyList
CreateProgmanGroup "ThumbsPlus", "", cmoNone
ShowProgmanGroup "ThumbsPlus", 1, cmoNone
CreateProgmanItem "ThumbsPlus", "ThumbsPlus", EXEFILE$, "", cmoOverwrite
CreateProgmanItem "ThumbsPlus", "Read Me", "notepad.exe "+MakePath(DEST$,"readme.txt"), "", cmoOverwrite
CreateProgmanItem "ThumbsPlus", "ThumbsPlus Help", MakePath(DEST$,"thumbs.hlp"), MakePath(DEST$,"tphelp.ico"), cmoOverwrite
CreateProgmanItem "ThumbsPlus", "ThumbsPlus Errors", MakePath(DEST$,"errors.hlp"), MakePath(DEST$,"tphelp.ico"), cmoOverwrite
CreateProgmanItem "ThumbsPlus", "ThumbsPlus Glossary", MakePath(DEST$,"glossary.hlp"), MakePath(DEST$,"tphelp.ico"), cmoOverwrite
' Remove PCDLIB.DLL from THUMBS directory, since it's now in the \WINDOWS\SYSTEM directory.
IF DoesFileExist(MakePath(DEST$,"pcdlib.dll"), femExists) THEN
RemoveFile MakePath(DEST$,"pcdlib.dll"), cmoForce
END IF
END SUB
' Adds keys to REG.DAT for ThumbsPlus
SUB RegisterDB STATIC
CreateRegKeyValue "ThumbsPlusPic", "ThumbsPlus Displayable Picture"
Base$ = "ThumbsPlusPic\shell\open\"
CreateRegKeyValue Base$+"command", EXEFILE$+" -dde"
CreateRegKeyValue Base$+"ddeexec", "Open(""%1"")"
Base$ = "ThumbsPlusPic\shell\print\"
CreateRegKeyValue Base$+"command", EXEFILE$+" -dde"
CreateRegKeyValue Base$+"ddeexec", "Print(""%1"")"
CreateRegKeyValue "ThumbsPlusDB", "ThumbsPlus Catalog Database"
CreateRegKeyValue "ThumbsPlusDB\shell\open\command", EXEFILE$+" %1"
CreateRegKeyValue "ThumbsPlusDB\CSWusername", USER$
CreateRegKeyValue "ThumbsPlusDB\CSWcode", CODE$
CreateRegKeyValue ".tud", "ThumbsPlusDB"
END SUB
' Appends a file name to the end of a directory path,
' inserting a backslash character 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