home *** CD-ROM | disk | FTP | other *** search
Wrap
'************************************************************************** '* '* CICA.MST - Runtime Setup Script '* '************************************************************************** '' Global variables GLOBAL TitleShortName$ GLOBAL TitleLongName$ GLOBAL MVBFileName$ GLOBAL PromptForPath% GLOBAL DefaultPath$ GLOBAL ProgManGroup$ GLOBAL ProgManItem$ GLOBAL Drive1$ GLOBAL Drive2$ GLOBAL ListBox$ ListBox$ = "ListItemsIn" '' **************************************************************** '' ** Setup Variables '' **************************************************************** '' Set the following string to a short form of the title name TitleShortName$ = "Standards" '' Set the following string to a long form of the title name TitleLongName$ = "InfoMagic Standards CD-ROM Viewer" '' Set the following variable to the name of the MVB file, without extension MVBFileName$ = "INFOSTND" '' The following variable determines whether Setup prompts the user '' to specify a directory in which to install title files. (Files '' to be installed on the hard disk must be listed in the TITLE.INF '' file under the [Installed Title Files] section.) Specify one of '' the following values: '' '' 0 Install title files in the Windows directory (default setting). '' This is an appropriate setting if you have a limited number '' of files to copy (for example, a single custom icon or DLL). '' '' 1 Display a dialog box to prompt the user for a directory in '' which to install files PromptForPath% = 1 '' If you have specified 1 in PromptForPath%, set the following '' variable to the default path that will be displayed in the dialog box DefaultPath$ = "C:\INFOSTND" '' Set the following variable to the name of the program manager group ProgManGroup$ = "InfoMagic Standards Browser" '' Set the following variable to the caption of the program manager item ProgManItem$ = "Standards CD-ROM" '*********************************************************************** '** Mainline '*********************************************************************** GLOBAL CUIDLL$ '' Include files '$INCLUDE 'setupapi.inc' '' Custom UI dll CUIDLL$ = "mscuistf.dll" '' Dialog ID's CONST DESTPATH = 1000 CONST APPHELP = 2000 CONST TOOBIG = 3000 CONST BADPATH = 4000 CONST SUCCESS = 5000 CONST ASKQUIT = 6000 CONST WELCOME = 7000 CONST SETDRIVES = 8000 '' Bitmap ID CONST LOGO = 1 '' Functions and subroutines '' DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER DECLARE SUB ModifyViewerIni(szTitleDir$) DECLARE SUB RegisterFont(fontfile$, fontname$) DECLARE SUB RegisterCustomFonts DECLARE SUB ModifyProgramManager(szTitleDir$) DECLARE SUB ShowSuccess DECLARE SUB ShowWelcome DECLARE SUB RegisterDrivers Declare Function ShowWindow Lib "User" (hWnd%, nCmdShow%) As Integer DIM hWnd% DIM iRet% '' The following statement turns size checking off. Set it to scmOnFatal '' to enable size checking, where Setup will compare the disk file size '' with the INF file size and report an error if they are not the same. i% = SetSizeCheckMode(scmOff) i% = SetCopyMode(1) '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to '' alter the banner bitmap. SetTitle "InfoMagic Standards Setup" SetBitmap CUIDLL$, LOGO '' Read in the INF file. ReadInfFile GetSymbolValue("STF_CWDDIR") + "INFOSTND.INF" '' Maximize the opening window hWnd% = HwndFrame() iRet% = ShowWindow(hWnd%, 3) '' Display Welcome dialog ShowWelcome '' Decide where to put title files IF PromptForPath% = 1 THEN szTitleDir$ = GetTitleDir(DefaultPath$) IF szTitleDir$ = "" THEN GOTO QUIT ENDIF ELSE szTitleDir$ = GetWindowsDir() ENDIF OpenLogFile MakePath( szTitleDir$, "STNDLOG.OUT"), 0 WriteToLogFile "" WriteToLogFile " Destination Directory: " + szTitleDir$ + " may have been created." WriteToLogFile "" '' Copy files IF CopyFiles(szTitleDir$) = 0 THEN GOTO QUIT ENDIF '' Create the MVIEWER2.EXE MVB association WriteToLogFile "" CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone AddListItem ListBox$, "Add entry to: " + GetWindowsDir()+"WIN.INI [Extensions]" '' Register in VIEWER.INI ModifyViewerIni szTitleDir$ '' Register custom fonts RegisterCustomFonts '' Register drivers RegisterDrivers '' Modify Program Manager ModifyProgramManager szTitleDir$ CloseLogFile '' Success dialog ShowSuccess '' Now start the title QUIT: END '************************************************************************* '** Purpose: '** Prompts the user for a path for the title files '** Arguments: '** szDefault$ - default path '** Returns: '** New valid path name, or "" if the user quit. '************************************************************************* FUNCTION GetTitleDir (szDefault$) STATIC AS STRING SetSymbolValue "String", TitleShortName$ SetSymbolValue "EditTextIn", szDefault$ SetSymbolValue "EditFocus", "ALL" GETPATH: sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc") IF sz$ = "CONTINUE" THEN szTitleDir$ = GetSymbolValue("EditTextOut") IF IsDirWritable(szTitleDir$) = 0 THEN BADPATH: sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO BADPATH END IF UIPop 1 GOTO GETPATH END IF UIPop 1 CreateDir szTitleDir$, cmoNone ELSEIF sz$ = "REACTIVATE" THEN GOTO GETPATH ELSE PATHQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN szTitleDir$ = "" UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO PATHQUIT ELSE UIPop 1 GOTO GETPATH END IF END IF GetTitleDir = szTitleDir$ SETDRIVES: SetSymbolValue "EditFocus", "ALL" SetSymbolValue "NameIn", MID$(GetSymbolValue("STF_SRCDIR"),1,1) SetSymbolValue "OrgIn", MID$(GetSymbolValue("STF_SRCDIR"),1,1) SetSymbolValue "Org2In", MID$(GetSymbolValue("STF_SRCDIR"),1,1) sz$ = UIStartDlg(CUIDLL$, SETDRIVES, "FNameOrgDlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO SETDRIVES ELSEIF sz$ = "CONTINUE" THEN UIPop 1 Drive1$ = GetSymbolValue("NameOut") Drive2$ = GetSymbolValue("OrgOut") ' i% = DoMsgBox( "D1: "+Drive1$+" D2: "+Drive2$, " msg " , MB_OK+MB_TASKMODAL ) ELSE DRVQUIT: UIPop 1 sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO DRVQUIT ELSE UIPop 1 GOTO SETDRIVES END IF END IF END FUNCTION '************************************************************************* '** Purpose: '** Copies the files in the INF file '** Arguments: '** szTitleDir$ - destination directory for the title files '** Returns '** 1 if files were copied, 0 otherwise '************************************************************************* FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER Syslist$ = "SysList" Applist$ = "AppList" ' i% = DoMsgBox( "into CopyFiles routine ", " msg " , MB_OK+MB_TASKMODAL ) '' Add all system files to the copy list AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir() '' Add all of the title files to the copy list AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$ ' i% = DoMsgBox( "about to open logfile ", " msg " , MB_OK+MB_TASKMODAL ) FOR i% = 1 to 11 STEP 1 temp$ = GetSectionKeyFilename( "System Files", "T"+STR$( i% ) ) start% = INSTR( temp$, "\" ) + 1 ''skip the backslash IF start% < 1 THEN start% = 1 ENDIF temp2$ = GetWindowsSysDir()+MID$( temp$, start% ) WriteToLogFile "Adding System file... " + temp2$ AddListItem ListBox$, temp2$ NEXT i% FOR i% = 1 to 4 STEP 1 temp$ = GetSectionKeyFilename( "Installed Title Files", "T"+STR$( i% ) ) start% = INSTR( temp$, "\" ) IF start% < 1 THEN start% = 1 ENDIF temp2$ = szTitleDir$+MID$( temp$, start% ) WriteToLogFile "Adding User file... " + temp2$ AddListItem ListBox$, temp2$ NEXT i% ' i% = DoMsgBox( "just closed logfile ", " msg " , MB_OK+MB_TASKMODAL ) szExtras$ = "Extra" szCosts$ = "Costs" szNeededs$ = "Neededs" FOR i% = 1 TO 26 STEP 1 AddListItem szExtras$, "0" NEXT i% '' We assume that VIEWER.INI will take another 4K ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096) '' Get amount of space required StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$) '' Put up a message if there is not enough space FOR i% = 1 TO 26 STEP 1 IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024)) SetSymbolValue "String2", CHR$(i% - 1 + ASC("A")) TOOBIG: sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO TOOBIG END IF UIPop 1 CopyFiles = 0 GOTO DONTCOPY END IF NEXT i% '' Copy the files CopyFilesInCopyList CopyFiles = 1 DONTCOPY: END FUNCTION '************************************************************************* '** Purpose: '** Puts up a success dialog '************************************************************************* SUB ShowSuccess STATIC SUCCESS: SetSymbolValue "String1", TitleShortName$ '' sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "") sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FListDlgProc", 0, "") IF sz$ = "CONTINUE" THEN UIPop 1 RUN "mviewer2.exe " + MVBFileName$ + ".MVB", NOWAIT ELSEIF sz$ = "REACTIVATE" THEN GOTO SUCCESS ELSE UIPop 1 END IF END SUB '************************************************************************* '** Purpose: '** Puts up a Welcome dialog '************************************************************************* SUB ShowWelcome STATIC WELCOME: sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, "FHelpDlgProc") IF sz$ = "CONTINUE" THEN UIPop 1 GOTO ENDSUB ELSEIF sz$ = "REACTIVATE" THEN GOTO WELCOME END IF ASKQUIT: sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 GOTO WELCOME END IF ENDSUB: 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 '************************************************************************* '** Purpose: '** Registers a font. '** Arguments: '** fontfile$ - font filename '** fontname$ - font name. '************************************************************************* SUB RegisterFont(fontfile$, fontname$) STATIC '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL '' IF AddFont(fontfile$, fontname$) = -1 THEN '' j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0) '' ENDIF END SUB '************************************************************************* '** Purpose: '** Registers title in VIEWER.INI '************************************************************************* SUB ModifyViewerIni (szTitleDir$) STATIC '' Get the VIEWER.INI file szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI") '' First register the title file, setting the Name and Path entries. '' We assume that the MVB file is the same directory as SETUP.EXE. '' '' CUSTOMIZATION: If you're installing multiple MVB files, copy the '' following two statements for each additional file, substituting '' the appropriate long name and MVB filename for the TitleLongName$ '' and MVBFileName$ variables. WriteToLogFile "" CreateIniKeyValue szIni$, MVBFileName$, "Name", TitleLongName$, cmoOverwrite '' CreateIniKeyValue szIni$, MVBFileName$, "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite CreateIniKeyValue szIni$, MVBFileName$, "Path", szTitleDir$, cmoOverwrite CreateIniKeyValue szIni$, MVBFileName$, "CDDrive1", Drive1$,cmoOverwrite CreateIniKeyValue szIni$, MVBFileName$, "CDDrive2", Drive2$,cmoOverwrite AddListItem ListBox$, GetWindowsDir()+"VIEWER.INI (create/modify)" '' Now we have to register the MVB file in the [FILES] section, so '' Viewer can find files that are not on the path and display a '' special message when a file is not found. '' CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", szTitleDir$ + "," + "The " + TitleLongName$ + " could not be found. Please re-run SETUP from the CD.", cmoOverwrite CreateIniKeyValue szIni$, "FILES", "STNDHELP.MVB", szTitleDir$ + "," + "The " + TitleLongName$ + " could not be found. Please re-run SETUP from the CD.", cmoOverwrite CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".DLL", szTitleDir$ + "," + "The " + TitleLongName$ + " DLL could not be found. Please re-run SETUP from the CD.", cmoOverwrite END SUB '************************************************************************* '** Purpose: '** Creates program manager entries for the title '************************************************************************* SUB ModifyProgramManager (szTitleDir$) STATIC '' Create the program manager group CreateProgmanGroup ProgmanGroup$, "", cmoNone ShowProgmanGroup ProgmanGroup$, 1, cmoNone '' Create an entry for the title WriteToLogFile "" CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(szTitleDir$, MVBFileName$ + ".MVB"), MakePath(szTitleDir$, MVBFileName$ + ".ICO"), cmoOverwrite AddListItem ListBox$, "Add program manager group:" + ProgmanGroup$ '' CUSTOMIZATION: '' '' To create additional Program Manager items, copy the preceding '' statement for each additional item, substituting the appropriate '' Program Manager item name for ProgmanItem$ and filename for '' MVBFileName$. '' '' To display a custom icon with the Program Manager item, specify '' the icon filename with the fourth parameter (this parameter is '' currently an empty string, ""). The following example specifies '' an icon with the same filename as the .MVB file: '' '' CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".ICO"), cmoOverwrite END SUB '************************************************************************* '** Purpose: '** Registers custom fonts with Windows. '************************************************************************* SUB RegisterCustomFonts STATIC '' CUSTOMIZATION: If you install custom fonts, then add statements '' in this routine to register the fonts with the current Windows '' session and to add them to the WIN.INI [Fonts] section. '' '' Note that TrueType fonts can only be installed in Windows 3.1. '' RegisterFont automatically creates the required .FOT file for '' TrueType fonts. '' '' The following example registers a font residing in MISTRAL.TTF '' and installs the font with the name Mistral (True Type): '' '' RegisterFont "mistral.ttf", "Mistral (TrueType)" '' END SUB '************************************************************************* '** Purpose: '** Registers Windows drivers '************************************************************************* SUB RegisterDrivers STATIC '' CUSTOMIZATION: Video for Windows is not a standard component of '' Windows 3.1. If your title uses video, proceed as follows. '' '' 1) Add the following files to the [System Files] section of the INF file: '' '' dispdib.dll '' msvideo.dll '' indeo.drv '' mciavi.drv '' msvidc.drv '' '' 2) Add the above files to your release directory. US versions can be '' found in the \SYSTEM subdirectory of your Viewer disc. French and '' German versions were not available at ship time. Please contact '' Microsoft or check the Multimedia Viewer section on the Microsoft '' Compuserve Forum for further details. '' '' 3) Uncomment the following lines: '' '' CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone END SUB