home *** CD-ROM | disk | FTP | other *** search
Wrap
'************************************************************************** '* Presentation Partner CD-ROM Setup '* Started 5/3/94 Tim Swetonic '* originally adapted from the Music Mentor '* CD-ROM Edition Setup '* '* '* Changes: '* 1\10\93 '* Bitmap fills screen for 800x600 and greater, title bar and border is on background bitmap, '* checks if directory is already present, checks for enough hard drive space. '* '************************************************************************** '$DEFINE PRESPART '$INCLUDE 'setupapi.inc' '$INCLUDE 'msdetect.inc' DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG DECLARE FUNCTION GetWindowLong LIB "user.exe" (hWnd%, offset%) AS LONG DECLARE FUNCTION WinExec LIB "krnl386.exe" (commandLine$, iShow%) AS INTEGER Declare Function FindWindow Lib "User" (lpClassName$, lpWindowName$) As Integer Declare Sub SetWindowPos Lib "User" (hWnd As Integer, hWndInsertAfter As Integer, X As Integer, Y As Integer, cx As Integer, cy As Integer, wFlags As Integer) Declare Function WritePrivateProfileString Lib "krnl386.exe" (lpApplicationName$, lpKeyName$, lpString$, lplFileName$) As Integer Declare Function SendMessage Lib "User" (hWnd As Long, wMsg As Integer, wParam As Integer, lParam As Any) As Long Declare Function AddFontResource Lib "GDI" (lpFilename As String) As Integer ''Dialog ID's CONST WELCOME = 100 CONST WELCOMEX = 150 CONST ASKQUIT = 200 CONST ASKQUITX = 250 CONST DESTPATH1 = 300 CONST DESTPATH1X = 350 CONST DESTPATH2 = 6401 CONST DESTPATH2X = 6451 CONST EXITFAILURE = 400 CONST EXITFAILUREX = 450 CONST EXITQUIT = 600 CONST EXITQUITX = 650 CONST EXITSUCCESS = 700 CONST EXITSUCCESSX = 750 CONST APPHELP = 900 CONST APPHELPX = 950 CONST ALREADYEXISTS = 1000 CONST ALREADYEXISTSX = 1050 CONST TOOBIG = 6300 CONST TOOBIGX = 6350 CONST BADPATH = 6400 CONST BADPATHX = 6450 CONST INFO1 = 109 CONST INFO2 = 6455 CONST INFO2X = 6455 CONST INSTALLVFW = 108 'CONST INFO3X = 6457 'CONST INFO3 = 6458 CONST HDSPACE = 4096000 CONST WS_VISIBLE = &H10000000 CONST WS_CLIPCHILDREN = &H2000000 CONST WS_BORDER = &H800000 CONST SW_SHOWMAXIMIZED = 3 CONST SW_SHOWNORMAL = 1 CONST GWL_STYLE =-16 CONST SWP_SHOWWINDOW = &H40 CONST HWND_BROADCAST = &HFFFF CONST WM_FONTCHANGE = &H1D CONST TITLE = "Multimedia Songbook Setup" CONST LOGO1 = 1 CONST LOGO2 = 1 'GLOBAL SrcDir$ GLOBAL DEST$ ''Default destination directory. GLOBAL SESDEST$ ''Default Session directory. GLOBAL RUNDEST$ ''Default Runtime subdirectory. GLOBAL OPTCUR$ ''Option selection from option dialog. GLOBAL SCRWID% GLOBAL PRESPARTDIR$ GLOBAL CUIDLL$ GLOBAL hdList$ GLOBAL hwndBackground As Integer DECLARE SUB Install DECLARE SUB CheckInstallVFW DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING DECLARE SUB CreateProgGroup DECLARE SUB ShowBackground(hwnd%) INIT: CUIDLL$ = "mscuistf.dll" ''Custom user interface dll HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure aboutStr1$ = "Multimedia Songbook" + Chr$(13) aboutStr1$ = aboutStr1$ + "Copyright (c) 1994" + Chr$(13) aboutStr2$ = "Release version" + Chr$(13) aboutStr2$ = aboutStr2$ + "August 28, 1994" + Chr$(13) mainWnd%=HwndFrame() curLong& = GetWindowLong (mainWnd%, GWL_STYLE) 'Creates window with curLong& = curLong& OR (WS_BORDER OR WS_CLIPCHILDREN OR WS_CAPTION) 'title bar (Note: using w&=SetWindowLong (mainWnd%, GWL_STYLE, curLong&) 'HT video drivers icon 'on one screen is corrupt) 'Set text shown in the About dialog, selected from the system menu SetAbout aboutStr1$, aboutStr2$ 'w&=SetWindowLong(mainWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN) j%=ShowWindow(mainWnd%,SW_SHOWMAXIMIZED) 'GetLocalHardDrivesList hdList$ 'listStr$ = GetListItem(hdList$, 1) SCRWID% = GetScreenWidth() IF SCRWID% = 640 THEN SetBitmap CUIDLL$, LOGO1 ELSE SetBitmap CUIDLL$, LOGO2 END IF SetTitle TITLE szInf$ = GetSymbolValue("STF_SRCINFPATH") IF szInf$ = "" THEN szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF" END IF ReadInfFile szInf$ OPTCUR$ = "1" DEST$ = "C:\SONGBOOK" 'SESDEST$ = "C:\SESSION" WELCOME: IF scrwid% = 640 THEN sz$ = UIStartDlg(CUIDLL$, WELCOMEX, "FInfoDlgProc", APPHELP, HELPPROC$) ShowBackground hwndBackground ELSE sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$) ShowBackground hwndBackground END IF ShowBackground hwndBackground IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOSUB ASKQUIT GOTO WELCOME END IF GETPATH: SetSymbolValue "EditTextIn", DEST$ SetSymbolValue "EditFocus", "END" GETPATHL1: IF scrwid% = 640 THEN sz$ = UIStartDlg(CUIDLL$, DESTPATH1X, "FEditDlgProc", APPHELP, HELPPROC$) ELSE sz$ = UIStartDlg(CUIDLL$, DESTPATH1, "FEditDlgProc", APPHELP, HELPPROC$) END IF DEST$ = GetSymbolValue("EditTextOut") IF sz$ = "CONTINUE" THEN IF IsDirWritable(DEST$) = 0 THEN GOSUB BADPATH 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 'Check if directory exists IF DoesDirExist(DEST$) THEN UIPop 1 IF SCRWID% = 640 THEN sz$ = UIStartDlg(CUIDLL$, ALREADYEXISTSX, "FInfoDlgProc", 0, "") ELSE sz$ = UIStartDlg(CUIDLL$, ALREADYEXISTS, "FInfoDlgProc", 0, "") END IF 'Screen resolution IF sz$ = "CONTINUE" THEN UIPop 1 ELSEIF sz$ = "REACTIVATE" THEN UIPop 1 GOTO GETPATHL1 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO GETPATHL1 ELSE UIPop 1 GOSUB ASKQUIT GOTO GETPATH END IF 'User responses for already exists dialog END IF 'If directory already exists checkdltr$ = mid$(DEST$, 1, 1) checkdspc& = GetFreeSpaceForDrive(checkdltr$) IF checkdspc& < HDSPACE THEN IF scrwid% = 640 THEN sz$ = UIStartDlg(CUIDLL$, TOOBIGX, "FInfoDlgProc", APPHELP, HELPPROC$) ELSE sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", APPHELP, HELPPROC$) END IF ERROR STFQUIT GOTO QUIT END IF '$IFNDEF PRESPART GETPATH2: SetSymbolValue "EditTextIn", SESDEST$ SetSymbolValue "EditFocus", "END" GETPATHL2: IF scrwid% = 640 THEN sz$ = UIStartDlg(CUIDLL$, DESTPATH2X, "FEditDlgProc", APPHELP, HELPPROC$) ELSE sz$ = UIStartDlg(CUIDLL$, DESTPATH2, "FEditDlgProc", APPHELP, HELPPROC$) END IF SESDEST$ = GetSymbolValue("EditTextOut") IF sz$ = "CONTINUE" THEN IF IsDirWritable(SESDEST$) = 0 THEN GOSUB BADPATH GOTO GETPATHL2 END IF UIPop 1 ELSEIF sz$ = "REACTIVATE" THEN GOTO GETPATHL2 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO GETPATH ELSE GOSUB ASKQUIT GOTO GETPATH2 END IF 'Check if directory exists IF DoesDirExist(SESDEST$) THEN UIPop 1 IF SCRWID% = 640 THEN sz$ = UIStartDlg(CUIDLL$, ALREADYEXISTSX, "FInfoDlgProc", 0, "") ELSE sz$ = UIStartDlg(CUIDLL$, ALREADYEXISTS, "FInfoDlgProc", 0, "") END IF 'Screen resolution IF sz$ = "CONTINUE" THEN UIPop 1 ELSEIF sz$ = "REACTIVATE" THEN UIPop 1 GOTO GETPATHL2 ELSEIF sz$ = "BACK" THEN UIPop 1 GOTO GETPATHL2 ELSE UIPop 1 GOSUB ASKQUIT GOTO GETPATH2 END IF 'User responses for already exists dialog END IF 'If directory already exists '$ENDIF MENTORCD Install QUIT: ON ERROR GOTO ERRQUIT IF ERR = 0 THEN IF SCRWID% = 640 THEN dlg% = EXITSUCCESSX ELSE dlg% = EXITSUCCESS END IF ELSEIF ERR = STFQUIT THEN IF SCRWID% = 640 THEN dlg% = EXITQUITX ELSE dlg% = EXITQUIT END IF ELSE 'MsgBox "" + ERROR$(ERR) IF SCRWID% = 640 THEN dlg% = EXITFAILUREX ELSE dlg% = EXITFAILURE END IF END IF QUITL1: sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO QUITL1 ELSE UIPop 1 CheckInstallVFW END IF UIPop 1 END ERRQUIT: i% = DoMsgBox("Setup sources were corrupted, please call Midisoft Technical Support", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND) END BADPATH: IF scrwid% = 640 THEN sz$ = UIStartDlg(CUIDLL$, BADPATHX, "FInfoDlgProc", APPHELP, HELPPROC$) ELSE sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", APPHELP, HELPPROC$) END IF IF sz$ = "REACTIVATE" THEN GOTO BADPATH END IF UIPop 1 RETURN ASKQUIT: IF scrwid% = 640 THEN sz$ = UIStartDlg(CUIDLL$, ASKQUITX, "FQuitDlgProc", APPHELP, HELPPROC$) ELSE sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", APPHELP, HELPPROC$) END IF IF sz$ = "EXIT" THEN UIPop 5 ERROR STFQUIT ELSEIF sz$ = "REACTIVATE" THEN GOTO ASKQUIT ELSE UIPop 1 END IF RETURN '** '** Purpose: '** Builds the copy list and performs all installation operations. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB Install STATIC 'Source Directories SrcDir$ = GetSymbolValue("STF_SRCDIR") ROOTDIR$ = SrcDir$ MIDIDIR$ = MakePath (ROOTDIR$, "MIDI") BMPDIR$ = MakePath (ROOTDIR$, "BITMAPS") CONTROLSDIR$ = MakePath (ROOTDIR$, "CONTROLS") FONTSDIR$ = MakePath(ROOTDIR$, "FONTS") CreateDir DEST$, cmoNone winSysDir$ = GetWindowsSysDir() winDir$ = GetWindowsDir() 'check for font files ' if EXISTS(winSysDir$ + "CGBSWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F1", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Garamand Classic Bold (TrueType)","CGBSWFTE.FOT", "win.ini") ' end if 'if EXISTS(winSysDir$ + "CGRSWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F2", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Garamand Classic Book (TrueType)","CGRSWFTE.FOT", "win.ini") ' end if 'if EXISTS(winSysDir$ + "FUASWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F3", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Futuri (TrueType)","FUASWFTE.FOT", "win.ini") ' end if 'if EXISTS(winSysDir$ + "FUBSWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F4", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Futuri Bold (TrueType)","FUBSWFTE.FOT", "win.ini") ' end if 'if EXISTS(winSysDir$ + "GAASWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F5", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Garamand (TrueType)","GAASWFTE.FOT", "win.ini") ' end if 'if EXISTS(winSysDir$ + "GABSWFTE.FOT") then 'else ' AddSectionFilesToCopyList "F6", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Garamand Bold (TrueType)","GABSWFTE.FOT", "win.ini") 'end if 'if EXISTS(winSysDir$ + "GCASWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F7", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Garamand Condensed (TrueType)","GCASWFTE.FOT", "win.ini") ' end if 'if EXISTS(winSysDir$ + "GCBSWFTE.FOT") then ' else ' AddSectionFilesToCopyList "F8", FONTSDIR$, winSysDir$ ' writeString% = WritePrivateProfileString("fonts", "Garamand Condensed Bold (TrueType)","GCBSWFTE.FOT", "win.ini") ' end if if EXISTS(winSysDir$ + "CGBSWFTE.TTF") then else AddSectionFilesToCopyList "T1", FONTSDIR$, winSysDir$ end if if EXISTS(winSysDir$ + "CGRSWFTE.TTF") then else AddSectionFilesToCopyList "T2", FONTSDIR$, winSysDir$ end if 'if EXISTS(winSysDir$ + "FUASWFTE.TTF") then ' else ' AddSectionFilesToCopyList "T3", FONTSDIR$, winSysDir$ ' end if ' if EXISTS(winSysDir$ + "FUBSWFTE.TTF") then ' else ' AddSectionFilesToCopyList "T4", FONTSDIR$, winSysDir$ ' end if if EXISTS(winSysDir$ + "GAASWFTE.TTF") then else AddSectionFilesToCopyList "T5", FONTSDIR$, winSysDir$ end if if EXISTS(winSysDir$ + "GABSWFTE.TTF") then else AddSectionFilesToCopyList "T6", FONTSDIR$, winSysDir$ end if if EXISTS(winSysDir$ + "GCASWFTE.TTF") then else AddSectionFilesToCopyList "T7", FONTSDIR$, winSysDir$ end if if EXISTS(winSysDir$ + "GCBSWFTE.TTF") then else AddSectionFilesToCopyList "T8", FONTSDIR$, winSysDir$ end if AddSectionFilesToCopyList "Controls", CONTROLSDIR$, winSysDir$ AddSectionFilesToCopyList "DLLs", CONTROLSDIR$, DEST$ 'AddSectionFilesToCopyList "Windows", ROOTDIR$, winDir$ AddSectionFilesToCopyList "Songbook", ROOTDIR$, DEST$ ClearBillboardList AddToBillboardList CUIDLL$, INFO1, "FModelessDlgProc", 50 AddToBillboardList CUIDLL$, INFO2, "FModelessDlgProc", 50 CopyFilesInCopyList 'ICONPATH$ = MakePath(SrcDir$,"MENTOR.ICO") QUICKICONPATH$ = MakePath(SrcDir$,"QUIKTOUR.ICO") CreateProgmanGroup "Midisoft Multimedia Songbook", "", cmoNone ShowProgmanGroup "Midisoft Multimedia Songbook", 1, cmoNone CreateProgmanItem "Midisoft Multimedia Songbook", "Midisoft Multimedia Songbook", DEST$ + "\SONGBOOK.EXE", "", cmoOverwrite CreateProgmanItem "Midisoft Multimedia Songbook", "The Songbook Quick Tour", MakePath(SrcDir$,"QUIKTOUR.EXE"), "", cmoOverwrite 'prog$ = "PROGRAM" ' basePath$ = "BasePath" ' winDir$ = winDir$ + "mentor2.ini" ' writeString% = WritePrivateProfileString(prog$, basePath$, SrcDir$, winDir$) ini$ = MakePath (GetWindowsDir, "songbk2.ini") CreateIniKeyValue ini$, "PROGRAM", "BasePath", SrcDir$, cmoOverwrite CreateIniKeyValue ini$, "PROGRAM","MapperLevel","", cmoOverwrite CreateIniKeyValue ini$, "Noodler", "NoteMapping", "1", cmoOverwrite CreateIniKeyValue ini$, "Noodler", "Loaded", "1", cmoOverwrite CreateIniKeyValue ini$, "Video", "Sound", "1", cmoOverwrite addFont = AddFontResource("CGBSWFTE.FOT") addFont = AddFontResource("CGRSWFTE.FOT") addFont = AddFontResource("GAASWFTE.FOT") addFont = AddFontResource("GABSWFTE.FOT") addFont = AddFontResource("GCASWFTE.FOT") addFont = AddFontResource("GCBSWFTE.FOT") addFont = AddFontResource("FUASWFTE.FOT") addFont = AddFontResource("FUBSWFTE.FOT") fontChange = SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0) END SUB SUB CheckInstallVFW STATIC sz$ = UIStartDlg(CUIDLL$, INSTALLVFW, "FInfoDlgProc", APPHELP, HELPPROC$) if sz$ = "CONTINUE" then UIPop 1 'run Video for Windows Setup SrcDir$ = GetSymbolValue("STF_SRCDIR") runLine$ = SrcDir$ + "_SETUP.EXE" RUN runLine$, NOWAIT 'exec% = WinExec(runLine$, 1) 'SW_SHOWNORMAL END else UIPop 1 END end if 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 '************************************************************************ ' CreateProgGroup ' This subroutine creates a program manager group if the user elects ' to run mentor from the cd-rom SUB CreateProgGroup STATIC SrcDir$ = GetSymbolValue("STF_SRCDIR") RUNDEST$ = MakePath(SrcDir$, "RUNTIME") ICONPATH$ = MakePath(RUNDEST$,"MENTOR.ICO") CreateIniKeyValue "Win.ini", "Extensions", "mtr", MakePath(DEST$,"TBOOK.EXE"), cmoOverwrite CreateProgmanGroup "Music Mentor CD-ROM Edition", "", cmoNone ShowProgmanGroup "Music Mentor CD-ROM Edition", 1, cmoNone CreateProgmanItem "Music Mentor CD-ROM Edition", "Music Mentor CD-ROM Edition", MakePath(RUNDEST$,"TBOOK.EXE") + " " + SrcDir$ + "MENTOR.MTR", ICONPATH$, cmoOverwrite END SUB SUB ShowBackground (hwnd%) STATIC SetWindowPos hwnd%, 1, 0, 0, 640, 480, SWP_SHOWWINDOW END SUB