home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 September
/
pcwk_09_96.iso
/
ydpdemo
/
lingua.mst
< prev
next >
Wrap
Text File
|
1996-07-04
|
15KB
|
484 lines
'**************************************************************************
'* YDP demo setup application
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'msregdb.inc'
'$INCLUDE 'msshared.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITWIN32S = 500
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST RESTARTDLG = 1000
CONST GETLANG = 1900
CONST BADPATH = 6400
CONST SMALLWIN = 2200
CONST RESTART = 2600
CONST RESTARTII = 2700
CONST WAIT = 5000
CONST GETPASSWORD = 7801
CONST HELP_1 = 7802
CONST HELP_2 = 7803
CONST HELP_3 = 7804
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL DESTSYS$ '' system directory
GLOBAL LANGUAGE$ ''Student language
GLOBAL LangLearn$ '' Learn language
GLOBAL CUIDLL$ ''Custom user interface dll
GLOBAL HELPPROC$ ''Help dialog procedure
GLOBAL VIDEO%
DECLARE SUB Install
DECLARE SUB Register
DECLARE SUB NativeLanguage
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE fUNCTION ExitWindowsExec LIB "User" (Exec$, Param$) AS INTEGER
DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
DECLARE FUNCTION ShowWindow LIB "user" (hwnd%, flag%) AS INTEGER
DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
INIT:
' Okno na caly ekran
i% = ShowWindow(HwndFrame(),3)
DEST$ = "C:\YDPdemo"
LangLearn$ = ""
DESTSYS$ = GetWindowsSysDir()
CUIDLL$ = "mscuistf.dll"
HELPPROC$ = "FHelpDlgProc"
SetBitmap CUIDLL$, LOGO
SetTitle "YDP Multimedia Demo Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "Lingua.INF"
END IF
ReadInfFile szInf$
szInf$ = ""
VIDEO% = 0
'' Can not run on versions less than 3.10.
IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 12 THEN
'' Check if Win32s is partially installed
sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup")
'' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
IF sz$ = "0" THEN
ERR = 5
GOTO QUIT
END IF
'' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
IF sz$ <> "1" THEN
ERR = 5
GOTO QUIT
END IF
'' If Win32s is already installed, get running version number
i% = DoesFileExist( DESTSYS$ + "W32SYS.DLL", femExists )
IF i% = 1 THEN
i% = IsWin32sLoaded( szOldVer$ )
ENDIF
IF i% = 0 THEN
ERR = 5
GOTO QUIT
END IF
' Check if video is
dir$ = GetWindowsDir() + "system.ini"
sz$ = GetIniKeyString(dir$, "Drivers", "MSACM.msadpcm")
IF LEN(sz$) = 0 THEN
VIDEO% = 1
ENDIF
END IF
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", HELP_3, HELPPROC$)
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
LANGUAGE$ = "Polish"
Install
sz$ = UIStartDlg(CUIDLL$, RESTARTDLG, "FInfoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
i% = ExitWindowsExec( GetWindowsDir() + "_MSRSTRT.EXE", "_MSSETUP.BAT" )
ENDIF
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSEIF ERR = 5 THEN
dlg% = EXITWIN32S
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "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
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
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
WriteToLogFile "Windows directory: " + GetWindowsDir
WriteToLogFile ""
WriteToLogFile "Windows directory: " + GetWindowsSysDir
WriteToLogFile ""
'// Create directories
newDir$ = DEST$
CreateDir newDir$, cmoNone
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
'// Install runtime libraries
version% = GetWindowsMinorVersion()
AddSectionFilesToCopyList "Bin", SrcDir$, DEST$
IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 12 THEN
AddSectionFilesToCopyList "win32s", SrcDir$, WinSysDir$
ELSE
AddSectionFilesToCopyList "Runtime95", SrcDir$, WinSysDir$
END IF
AddSectionFilesToCopyList "Fonts", SrcDir$, WinSysDir$
IF VIDEO% = 1 THEN
'// Install Video
AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "Indeo-ini", SrcDir$, WinDir$
ENDIF
'' Check windrive diskspace
SizeReq& = GetCopyListCost ("","", "")
IF SizeReq& <> 0 THEN
sz$ = UIStartDlg(CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "")
END
END IF
'// Copy files
CopyFilesInCopyList
IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 12 THEN
Run( "regsvr32 /s " + SrcDir$ + "\runtime\win32s\mfc40.dll" )
Run( "regsvr32 /s " + SrcDir$ + "\runtime\win32s\olepro32.dll" )
END IF
sz$ = UIStartDlg(CUIDLL$, WAIT, "FModelessDlgProc", 0, "")
'// Register video
Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
Register
UIPop 1
'// Register fonts in windows
CreateIniKeyValue "win.ini", "fonts", "Comic Sans MS (True Type)", "COMIC.FOT", cmoOverwrite
IF VIDEO% = 1 THEN
Run ("profdisp.exe")
ENDIF
'// Create program manager group
CreateProgmanGroup "YDP Multimedia Demo", "", cmoNone
ShowProgmanGroup "YDP Multimedia Demo", 1, cmoNone
sz$ = MakePath(DEST$,"ydpdemo.exe")
CreateProgmanItem "YDP Multimedia Demo", "YDP Multimedia Demo", sz$, "", cmoOverwrite
CloseLogFile
END SUB
'**
'** Purpose:
'** Register OLE & ini files
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Register STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
'// Edit lingua.ini file in Windows directory
ini$ = MakePath(WinDir$, "Lingua.ini")
CreateIniKeyValue ini$, "Main", "Learn", LangLearn$, cmoOverwrite
NativeLanguage
' Create pathes
value$ = MakePath(SrcDir$,"data\")
CreateIniKeyValue ini$, "Path", "Data", value$, cmoOverwrite
CreateIniKeyValue ini$, "Path", "bin", Dest$ +"\", cmoOverwrite
value$ = MakePath(SrcDir$,"config\")
CreateIniKeyValue ini$, "Path", "config", value$, cmoOverwrite
value$ = MakePath(SrcDir$,"picture\")
CreateIniKeyValue ini$, "Path", "picture", value$, cmoOverwrite
value$ = MakePath(SrcDir$,"sound\")
CreateIniKeyValue ini$, "Path", "sound", value$, cmoOverwrite
' Add fonts
CreateIniKeyValue ini$, "Font", "usa", "Comic Sans MS", cmoOverwrite
CreateIniKeyValue ini$, "font", "pl", "Arial CE", cmoOverwrite
' register components
sz$ = MakePath(DEST$,"Animate.dll")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Baloon.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Cartoon.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Cross.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Fallword.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Garden.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Grama.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Label.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"peter.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Crosscom.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"shoot.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"totlscor.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"txtstore.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"factory.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"Intro.ocx")
Run("regsvr32.exe /s " + sz$)
sz$ = MakePath(DEST$,"video32.ocx")
Run("regsvr32.exe /s " + sz$)
IF VIDEO% = 1 THEN
''Updating WIN.INI and SYSTEM.INI
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "indeov.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
I% = DoesIniKeyExist (WinDir$ + "system.ini", "Drivers", "VIDC.RT21")
IF I% = 0 THEN
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "indeov.drv", cmoOverwrite
END IF
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "indeov.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
ENDIF
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
SUB NativeLanguage STATIC
native$ = "GB"
native_epp$ = "GB"
IF LANGUAGE$ = "German" THEN
native$ = "D"
native_epp$ = "D"
ELSEIF LANGUAGE$ = "Dennish" THEN
native$ = "GB"
native_epp$ = "DK"
ELSEIF LANGUAGE$ = "French" THEN
native$ = "F"
native_epp$ = "F"
ELSEIF LANGUAGE$ = "English" THEN
native$ = "GB"
native_epp$ = "GB"
ELSEIF LANGUAGE$ = "Polish" THEN
native$ = "PL"
native_epp$ = "PL"
ELSEIF LANGUAGE$ = "Russian" THEN
native$ = "RUS"
native_epp$ = "RUS"
ELSEIF LANGUAGE$ = "Finnish" THEN
native$ = "FIN"
native_epp$ = "FIN"
ELSEIF LANGUAGE$ = "Spanish" THEN
native$ = "E"
native_epp$ = "GB"
ELSEIF LANGUAGE$ = "Dutch" THEN
native$ = "NL"
native_epp$ = "NL"
ELSEIF LANGUAGE$ = "Turkish" THEN
native$ = "TR"
native_epp$ = "GB"
ENDIF
SrcDir$ = GetSymbolValue("STF_SRCDIR")
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
'// Edit lingua.ini file in Windows directory
ini$ = MakePath(WinDir$, "Lingua.ini")
CreateIniKeyValue ini$, "Main", "Native", native$, cmoOverwrite
value$ = MakePath(SrcDir$,"demo\" + native$ + "\demo.exe")
CreateIniKeyValue ini$, "demo", "epp", value$, cmoOverwrite
END SUB