home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '*
- '* EasyPhoto 2.0 setup script
- '* based on MSSetup Toolkit Sample 2
- '*
- '**************************************************************************
- '*'$DEFINE DEBUG '* Used for Debugging messages
- '*COMMAND$ = "/S D:\EZPHOTO_\" '* For running in Test Environment
-
- '* Set up resuming of errors
- GLOBAL RESUME_ON_ERROR%
- GLOBAL ERR_RESUME%
- RESUME_ON_ERROR% = 0
- ERR_RESUME% = 0
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- '* Subroutine declaration
- DECLARE SUB Initialize
- DECLARE SUB EasyInstall
- DECLARE SUB DoInstall
- DECLARE SUB DoUninstall
- DECLARE SUB DoQuit
- DECLARE SUB QueryQuit
- DECLARE FUNCTION InfoDialog( dialogID%) AS STRING
- DECLARE SUB CalculateTotalNeeds
- DECLARE SUB CalculateExistingPath
- DECLARE FUNCTION NeedsWillFit AS INTEGER
- DECLARE SUB AddSectionFilesToDeleteList( list$, section$, path$)
- DECLARE FUNCTION MakePath ( szDir$, szFile$) AS STRING
- DECLARE FUNCTION ShowWindow LIB "user" ( hwnd%, nCmdShow%) AS INTEGER
- DECLARE FUNCTION SetWindowPos LIB "user" ( hwnd%, hwndInsertAfter%, x%, y%, cx%, cy%, fuFlags%) AS INTEGER
- DECLARE FUNCTION DeleteDirectory LIB "mscuistf.dll" ( dirStr$) AS INTEGER
- DECLARE FUNCTION GetModuleHandle LIB "kernel" ( modName$) AS INTEGER
- DECLARE FUNCTION ExitWindowsExec LIB "user" ( exec$, param$) AS INTEGER
- DECLARE FUNCTION WinExec LIB "kernel" ( cmdLine$, nCmdShow%) AS INTEGER
- DECLARE SUB UpdateRegFile
-
- '* Dialog IDs
- CONST DLG_EASYINSTALL = 11000
- CONST DLG_INFO_TOOBIG = 13001
- CONST DLG_INFO_BADPATH = 13002
- CONST DLG_INFO_ASKQUIT = 13003
- CONST DLG_INFO_EXITOK = 13004
- CONST DLG_INFO_EXITQUIT = 13005
- CONST DLG_INFO_EXITFAIL = 13006
- CONST DLG_INFO_UNINSTALLOK = 13007
- CONST DLG_INFO_BADVERSION = 13008
- CONST DLG_INFO_NORESTART = 13009
- CONST DLG_INFO_NEEDRESTART = 13010
- CONST DLG_INFO_EPRUNNING = 13011
- CONST DLG_INFO_NOPROGGRP = 13015
- CONST DLG_INFO_HANDLER = 13016
- CONST DLG_PMCOMMAND = 14000
- CONST DLG_INFO_BADPROCESSOR = 14001
-
- '* Error code
- CONST UNINSTALL_COMPLETE = 10000
-
- '* Global for Custom User Interface DLL
- GLOBAL CUIDLL$
-
- '* Some Global strings.
- GLOBAL NEEDS_TOTAL$
- GLOBAL WINDOWSEXTRAS$
- GLOBAL EXISTPATH$
- GLOBAL DEST$
- GLOBAL WINWORD$
- GLOBAL SOURCEPATH$
-
- MAIN:
- '* Initialize
- Initialize
-
- '* Do easy install
- EasyInstall
-
- QUIT:
- '* If there is an error, but we are resuming, then set the ERR_RESUME flag and clear ERR flag
- '* Then RESUME on the NEXT instruction
- IF (( ERR <> 0) AND ( RESUME_ON_ERROR% = 1)) THEN
- ERR_RESUME% = ERR
- ERR = 0
- RESUME NEXT
- ENDIF
-
- '* Do normal quit
- DoQuit
- END
-
- '*******************************************************************************
- '* Initialize
- '*
- '* Perform necessary initializations
- '*******************************************************************************
- SUB Initialize STATIC
-
- '* Maximize the parent window
- result% = ShowWindow( HwndFrame(), 3) '* SW_SHOWMAXIMIZED
- '* SWP_NOMOVE | SWP_NOSIZE
- result% = SetWindowPos( HwndFrame(), -1, 0, 0, 0, 0, 3)
-
- '* Set up the custom UI and help dialog procedures
- CUIDLL$ = "MSCUISTF.DLL"
-
- '* Initialize some strings
- NEEDS_TOTAL$ = "TotalNeeds"
- WINDOWSEXTRAS$ = "ExtraCosts"
- EXISTPATH$ = "ExistingPath"
-
- '* Set the about box and main window title
- SetAbout "EasyPhoto Setup", "Copyright (c) 1995 Storm Software"
- SetTitle "EasyPhoto Installer"
-
- '* Determine the .INF file and read it in
- infPath$ = GetSymbolValue( "STF_SRCINFPATH")
- IF infPath$ = "" THEN
- infPath$ = GetSymbolValue( "STF_CWDDIR") + "SETUP.INF"
- ENDIF
- ReadInfFile infPath$
-
- '* Determines if we have the correct windows version or not...
- IF (( GetWindowsMajorVersion() < 3) OR (( GetWindowsMajorVersion = 3) AND ( GetWindowsMinorVersion < 1))) THEN
- resultStr$ = InfoDialog( DLG_INFO_BADVERSION)
- END
- ENDIF
-
- '* If we are on less than a 80386 processor then quit
- IF ( GetProcessorType < 3) THEN
- resultStr$ = InfoDialog( DLG_INFO_BADPROCESSOR)
- END
- ENDIF
-
- '* Make sure handler is not active
- IF ( GetModuleHandle( "HANDLER")) THEN
- resultStr$ = InfoDialog( DLG_INFO_HANDLER)
- END
- ENDIF
-
- '* Make sure that EasyPhoto is not running now
- IF ( GetModuleHandle( "EZPHOTO")) THEN
- resultStr$ = InfoDialog( DLG_INFO_EPRUNNING)
- END
- ENDIF
-
- '* Determine the source path, ie. E:\SETUP
- SOURCEPATH$ = GetSymbolValue( "STF_CWDDIR")
- SOURCEPATH$ = MID$( SOURCEPATH$, 1, LEN( SOURCEPATH$) - 6)
-
- '* Calculate the existing path
- CalculateExistingPath
-
- '* Determine default destination, which is either of
- '* - Currently installed location
- '* - Windows\EZPHOTO
- winDrive$ = UCASE$( MID$( GetWindowsDir, 1, 1))
- temp$ = GetSymbolValue( EXISTPATH$)
- IF temp$ = "" THEN
- DEST$ = winDrive$ + ":\EZPHOTO"
- ELSE
- IF ( MID$( temp$, LEN( temp$), 1) = "\") THEN
- temp$ = MID$ ( temp$, 1, LEN( temp$) - 1)
- ENDIF
- DEST$ = temp$
- ENDIF
-
- '* Determine the word for windows startup path
- iniPath$ = FindFileInTree( "WINWORD6.INI", GetWindowsDir)
- IF ( iniPath$ <> "") THEN
- WINWORD$ = GetIniKeyString( iniPath$, "Microsoft Word", "STARTUP-PATH")
- IF (DoesDirExist(WINWORD$) = 0) THEN
- WINWORD$ = ""
- ENDIF
- ELSE
- WINWORD$ = ""
- ENDIF
-
- '* Set up the drive lists
- FOR i% = 1 TO 26
- AddListItem WINDOWSEXTRAS$, "0"
- AddListItem NEEDS_TOTAL$, "0"
- NEXT i%
- ReplaceListItem WINDOWSEXTRAS$, ASC( winDrive$) - ASC( "A") + 1, "10240"
- END SUB
-
- '*******************************************************************************
- '* EasyInstall
- '*
- '* The main loop to query the user about installation options
- '*******************************************************************************
- SUB EasyInstall STATIC
-
- '* Loop
- WHILE 1
-
- '* Switch on the result of the primary dialog
- SetSymbolValue "PathText", DEST$
- SELECT CASE ( UIStartDlg( CUIDLL$, DLG_EASYINSTALL, "EasyInstallProc", 0, ""))
-
- '* Install was pressed, install only if each section fits
- CASE "INSTALL"
- newPath$ = GetSymbolValue( "PathText")
- IF ( IsDirWritable( newPath$) = 1) THEN
- DEST$ = newPath$
- CalculateTotalNeeds
- IF ( NeedsWillFit = 1) THEN
- UIPop 1
- DoInstall
- EXIT WHILE
- ELSE
- result$ = InfoDialog( DLG_INFO_TOOBIG)
- ENDIF
- ELSE
- result$ = InfoDialog( DLG_INFO_BADPATH)
- ENDIF
-
- '* Do an install
- CASE "UNINSTALL"
- UIPop 1
- DoUninstall
- EXIT WHILE
-
- CASE "EXIT"
- QueryQuit
-
- CASE "REACTIVATE"
- CalculateExistingPath
- END SELECT
- WEND
- END SUB
-
- '*******************************************************************************
- '* DoInstall
- '*
- '* Actually do the installation
- '*******************************************************************************
- SUB DoInstall STATIC
-
- '* Remove trailing \ in DEST$
- IF ( MID$( DEST$, LEN( DEST$), 1) = "\") THEN
- DEST$ = MID$ ( DEST$, 1, LEN( DEST$) - 1)
- ENDIF
-
- '* Make sure that we have a place to copy the files to
- CreateDir DEST$, cmoNone
- CreateDir MakePath( DEST$, "GALLERY"), cmoNone
- CreateDir MakePath( DEST$, "PHOTO"), cmoNone
-
- '* Sets the restart directory
- SetRestartDir DEST$
-
- '* Actually copy the files
- CopyFilesInCopyList
-
- '* Set the wait cursor and initialize
- CursorSave% = ShowWaitCursor()
-
- '* Fix up the OLE reg file
- UpdateRegFile
-
- '* Added mapping stuff
- DstStr$ = MakePath( GetWindowsDir, "WIN.INI")
- SetStr$ = MakePath( DEST$, "EZPHOTO.EXE") + " ^.GAL"
- CreateIniKeyValue DstStr$, "Extensions", "GAL", SetStr$, cmoOverwrite
-
- '* add&we added 9/7/95 to install WEMU387.386
- '* Create a duplicate of SYSTEM.INI called SYSTEM.GAL to tear apart for WEMU387.386
- SrcStr$ = MakePath( GetWindowsDir, "SYSTEM.INI")
- '* (we) I don't know why this needs to have a different extension
- DstStr$ = MakePath( GetWindowsDir, "SYSTEM.GA2")
- CopyFile SrcStr$, DstStr$, cmoOverWrite, 0
-
- '* Go through file looking for DEVICE=WEMU387.386 in [386Enh]
- WHILE 1
- result$ = GetIniKeyString( DstStr$, "386Enh", "DEVICE")
-
- '* If we found an existing one, then stop searching
- IF ( UCASE$( result$) = "WEMU387.386") THEN
- EXIT WHILE
-
- '* If there are no more DEVICE= then add it in the SYSTEM.INI
- ELSEIF ( result$ = "") THEN
- CreateSysIniKeyValue SrcStr$, "386Enh", "DEVICE", "WEMU387.386", cmoNone
- EXIT WHILE
-
- '* Otherwise, remove this DEVICE= and go to the next one
- ELSE
- RemoveIniKey DstStr$, "386Enh", "DEVICE", cmoNone
- ENDIF
- WEND
-
- '* Remove the temporary file
- RemoveFile DstStr$, cmoForce
-
- '* Add configuration info to EZPHOTO.INI
- DstStr$ = MakePath( GetWindowsDir, "EZPHOTO.INI")
- SetStr$ = DEST$ + "\"
- CreateIniKeyValue DstStr$, "EasyPhoto Directories", "AppRoot", SetStr$, cmoOverwrite
- CreateIniKeyValue DstStr$, "EasyPhoto Directories", "Template", SetStr$, cmoOverwrite
- SetStr$ = MakePath( DEST$, "GALLERY\")
- CreateIniKeyValue DstStr$, "EasyPhoto Directories", "Gallery", SetStr$, cmoOverwrite
- SetStr$ = MakePath( DEST$, "PHOTO\")
- CreateIniKeyValue DstStr$, "EasyPhoto Directories", "Photo", SetStr$, cmoOverwrite
- CreateIniKeyValue DstStr$, "Warning Max", "Max", "1", cmoOverwrite
- CreateIniKeyValue DstStr$, "Warning Max", "Current Count", "0", cmoOverwrite
-
- '* This next section can be resumed on an error
- RESUME_ON_ERROR% = 1
- ERR_RESUME% = 0
-
- '* Attempt to create a program manager group
- oldMode% = SetSilentMode( 1)
- CreateProgmanGroup "EasyPhoto", "", cmoVital
- ShowProgmanGroup "EasyPhoto", 1, cmoVital
- oldMode% = SetSilentMode( oldMode%)
-
- '* We don't want to resume on error any more
- RESUME_ON_ERROR% = 0
-
- '* Set cursor back
- RestoreCursor CursorSave%
-
- '* Check to see if the program manager group was created, if so create items.
- IF ( ERR_RESUME% = 0) THEN
- CreateProgmanItem "EasyPhoto", "Welcome to EasyPhoto!", MakePath( SOURCEPATH$, "DEMO\EZ2DEMO.EXE"), "", cmoOverwrite
- CreateProgmanItem "EasyPhoto", "Read Me!", "WRITE.EXE " + MakePath( DEST$, "EZ2READ.WRI"), "", cmoOverwrite
- '*CreateProgmanItem "EasyPhoto", "EasyPhoto" + CHR$(13) + "Try Me!", MakePath( DEST$, "EZPHOTO.EXE"), "", cmoOverwrite
- CreateProgmanItem "EasyPhoto", "EasyPhoto Try Me!", MakePath( DEST$, "EZPHOTO.EXE"), "", cmoOverwrite
-
- '* Otherwise, post a message about the failure to create the group.
- ELSE
- result$ = InfoDialog( DLG_INFO_NOPROGGRP)
- ENDIF
-
- '* If the restart list is not empty then do a restart
- IF ( RestartListEmpty = 0) THEN
- result$ = InfoDialog( DLG_INFO_NEEDRESTART)
- WHILE 1
- '* Remove the window's ONTOP attribute
- winresult% = SetWindowPos( HwndFrame(), -2, 0, 0, 0, 0, 3)
- resultNum% = ExitExecRestart
-
- '* user needs to get a chance to
- '* manually quit the applications that are still alive (DOS Boxes).
- IF ( InfoDialog( DLG_INFO_NORESTART) <> "OK") THEN
- EXIT WHILE
- ENDIF
- WEND
- ERROR STFERR
- ENDIF
-
- END SUB
-
- '*******************************************************************************
- '* DoUninstall
- '*
- '* Actually do the un-installation
- '*******************************************************************************
- SUB DoUninstall STATIC
-
- '* Set the wait cursor and initialize
- CursorSave% = ShowWaitCursor()
-
- '* Recalculate the existing path one last time, exit if does not exist.
- CalculateExistingPath
- DstStr$ = GetSymbolValue( EXISTPATH$)
-
- '* If we have an existing path, then delete everything
- IF ( DstStr$ <> "") THEN
-
- '* Remove trailing \ in DstStr$
- IF ( MID$( DstStr$, LEN( DstStr$), 1) = "\") THEN
- DstStr$ = MID$ ( DstStr$, 1, LEN( DstStr$) - 1)
- ENDIF
-
- '* Make a list from the file names from each section
- AddSectionFilesToDeleteList "DeleteList", "EZ_MAIN", DstStr$
- AddSectionFilesToDeleteList "DeleteList", "EZ_WIN", GetWindowsDir
- AddSectionFilesToDeleteList "DeleteList", "EZ_SYS", GetWindowsSysDir
- '* AddSectionFilesToDeleteList "DeleteList", "EZ_TWAIN", MakePath( GetWindowsDir, "TWAIN\PHOTO\")
- AddSectionFilesToDeleteList "DeleteList", "GALLERY", MakePath( DstStr$, "GALLERY")
- IF ( WINWORD$ <> "") THEN
- AddSectionFilesToDeleteList "DeleteList", "EZ_MS", WINWORD$
- ENDIF
-
- '* Add EZPHOTO.INI in windows directory
- AddListItem "DeleteList", MakePath( GetWindowsDir, "EZPHOTO.INI")
-
- '* Loop through those files and delete them all, if they truly exist
- FOR i% = 1 TO GetListLength( "DeleteList")
- fileStr$ = GetListItem( "DeleteList", i%)
- IF ( DoesFileExist( fileStr$, femExists) = 1) THEN
- RemoveFile fileStr$, cmoForce
- ENDIF
- NEXT i%
-
- '* Remove all of the directories, if possible...
- deleteResult% = DeleteDirectory( MakePath( DstStr$, "GALLERY"))
- deleteResult% = DeleteDirectory( MakePath( DstStr$, "PHOTO"))
- deleteResult% = DeleteDirectory( DstStr$)
- deleteResult% = DeleteDirectory( MakePath( GetWindowsDir, "TWAIN\PHOTO"))
- deleteResult% = DeleteDirectory( MakePath( GetWindowsDir, "TWAIN"))
-
- '* Create a duplicate of SYSTEM.INI called SYSTEM.GAL to tear apart for VPPSD.386
- SrcStr$ = MakePath( GetWindowsDir, "SYSTEM.INI")
- DstStr$ = MakePath( GetWindowsDir, "SYSTEM.GAL")
- CopyFile SrcStr$, DstStr$, cmoOverWrite, 0
-
- '* Remove program group from program manager
- SetSymbolValue "ProgmanCommand", "[DeleteGroup(EasyPhoto)]"
- result$ = UIStartDlg( CUIDLL$, DLG_PMCOMMAND, "SendProgmanProc", 0, "")
- UIPop 1
-
- '* Remove mapping stuff
- DstStr$ = MakePath( GetWindowsDir, "WIN.INI")
- RemoveIniKey DstStr$, "Extensions", "GAL", cmoNone
-
- ENDIF
-
- '* Set cursor back
- RestoreCursor CursorSave%
-
- ERR = UNINSTALL_COMPLETE
- END SUB
-
- '*******************************************************************************
- '* DoQuit
- '*
- '* Quit.
- '*******************************************************************************
- SUB DoQuit STATIC
-
- restart%=0
- '* Which dialog should we use depends upon the ERR code
- IF ERR = 0 THEN
- dlg% = DLG_INFO_NEEDRESTART '* was: DLG_INFO_EXITOK
- restart% = 1
- ELSEIF ERR = STFQUIT THEN
- dlg% = DLG_INFO_EXITQUIT
- ELSEIF ERR = UNINSTALL_COMPLETE THEN
- dlg% = DLG_INFO_UNINSTALLOK
- ELSE
- dlg% = DLG_INFO_EXITFAIL
- END IF
-
- '* Do the dialog, then kill it and end.
- result$ = UIStartDlg(CUIDLL$, dlg%, "InformationProc", 0, "")
- UIPop 1
-
- IF restart%=1 THEN
- '* Now we are ready to restart windows. Do this in a loop so
- '* that if the restart fails (because of open applications),
- '* we can tell the user what to do and try again.
- WHILE 1
- '*remove windows ON TOP attribute
- winresult% = SetWindowPos( HwndFrame(), -2, 0, 0, 0, 0, 3)
- exec$ = MakePath( DEST$, "_msrstrt.exe")
- monkey% = ExitWindowsExec( exec$, "")
-
- '* user needs to get a chance to manually quit the
- '*applications that are still alive (DOS Boxes).
- IF ( InfoDialog( DLG_INFO_NORESTART) <> "OK") THEN
- EXIT WHILE
- ENDIF
- WEND
- ENDIF
-
- '* Exit the application
- END
- END SUB
-
- '*******************************************************************************
- '* QueryQuit
- '*
- '* Popup the dialog to tell the user that they have selected an invalid path.
- '*******************************************************************************
- SUB QueryQuit STATIC
-
- '* Does the user want to quit?
- IF ( InfoDialog( DLG_INFO_ASKQUIT) = "EXIT") THEN
- END
- ENDIF
- END SUB
-
- '*******************************************************************************
- '* InfoDialog
- '*
- '* Generic information dialog, returns result of dialog as a string.
- '*******************************************************************************
- FUNCTION InfoDialog( dialogID%) STATIC AS STRING
-
- '* Do the Dialog, then kill it.
- InfoDialog = UIStartDlg( CUIDLL$, dialogID, "InformationProc", 0, "")
- UIPop 1
- END FUNCTION
-
- '*******************************************************************************
- '* CalculateTotalNeeds
- '*
- '* Calculates the total needs for the install
- '*******************************************************************************
- SUB CalculateTotalNeeds STATIC
-
- '* Set the wait cursor and initialize
- CursorSave% = ShowWaitCursor()
-
- '* Clear the copy list
- ClearCopyList
-
- '* Add the EZPhoto files to the copy list
- SrcDir$ = MakePath( GetSymbolValue( "STF_SRCDIR"), "EZPHOTO")
- AddSectionFilesToCopyList "EZ_MAIN", SrcDir$, DEST$
- AddSectionFilesToCopyList "EZ_WIN", SrcDir$, GetWindowsDir
- AddSectionFilesToCopyList "EZ_WINTW", SrcDir$, GetWindowsDir
- AddSectionFilesToCopyList "EZ_SYS", SrcDir$, GetWindowsSysDir
- AddSectionFilesToCopyList "EZ_SYSEMU", SrcDir$, GetWindowsSysDir
- '* AddSectionFilesToCopyList "EZ_TWAIN", SrcDir$, MakePath( GetWindowsDir, "TWAIN\PHOTO\")
- IF ( WINWORD$ <> "") THEN
- AddSectionFilesToCopyList "EZ_MS", SrcDir$, WINWORD$
- ENDIF
-
- '* Add the OLE2 files to the copy list
- SrcDir$ = MakePath( GetSymbolValue( "STF_SRCDIR"), "OLE2")
- AddSectionFilesToCopyList "OLE2_SYS", SrcDir$, GetWindowsSysDir
-
- '* Add the Gallery files to the copy list
- SrcDir$ = MakePath( GetSymbolValue( "STF_SRCDIR"), "GALLERY")
- AddSectionFilesToCopyList "GALLERY", SrcDir$, MakePath( DEST$, "GALLERY")
-
- '* Add the photo files to the copy list
- SrcDir$ = MakePath( GetSymbolValue( "STF_SRCDIR"), "PHOTO")
- AddSectionFilesToCopyList "PHOTO", SrcDir$, MakePath( DEST$, "PHOTO")
-
- '* Actually determine how much each list costs
- extra% = GetCopyListCost( WINDOWSEXTRAS$, NEEDS_TOTAL$, "")
-
- '* Restore the cursor back to original
- RestoreCursor CursorSave%
- END SUB
-
- '*******************************************************************************
- '* NeedsWillFit
- '*
- '* Recalculates disk space and returns if the files will fit each drive or not.
- '*******************************************************************************
- FUNCTION NeedsWillFit STATIC AS INTEGER
-
- '* Set wait cursor
- CursorSave% = ShowWaitCursor()
-
- '* Initialize
- NeedsWillFit = 1
-
- '* Go through each of the drives and check each drive
- FOR drive% = 1 TO 26
- needSpace& = VAL( GetListItem( NEEDS_TOTAL$, drive%))
- IF ( needSpace& > 0 ) THEN
- freeSpace& = GetFreeSpaceForDrive( CHR$( ASC( "A") + drive% - 1))
- IF ( freeSpace& < needSpace&) THEN
- NeedsWillFit = 0
- EXIT FOR
- ENDIF
- ENDIF
- NEXT drive%
-
- '* Set cursor back
- RestoreCursor CursorSave%
- END FUNCTION
-
- '*******************************************************************************
- '* CalculateExistingPath
- '*
- '* Calculates the existing path to a current installation
- '*******************************************************************************
- SUB CalculateExistingPath STATIC
-
- '* Locate the EZPHOTO.INI file and APPROOT Path...
- DstStr$ = MakePath( GetWindowsDir, "EZPHOTO.INI")
- result$ = GetIniKeyString( DstStr$, "EasyPhoto Directories", "AppRoot")
- SetSymbolValue EXISTPATH$, result$
- END SUB
-
- '*******************************************************************************
- '* AddSectionFilesToDeleteList
- '*
- '* Will add a bunch of files with a path to a final list
- '*******************************************************************************
- SUB AddSectionFilesToDeleteList( list$, section$, path$) STATIC
-
- '* Make a temporary list from the files in the particular section
- MakeListFromSectionFilename "TempList", section$
-
- '* Go through temporary list, adds appropriate path, then to final list
- FOR i% = 1 TO GetListLength( "TempList")
- fileStr$ = GetListItem( "TempList", i%)
- AddListItem list$, MakePath( path$, fileStr$)
- NEXT i%
- END SUB
-
- '*******************************************************************************
- '* MakePath
- '*
- '* Appends a file name to the end of a directory path,
- '* inserting a backslash character as needed.
- '*******************************************************************************
- FUNCTION MakePath ( szDir$, szFile$) STATIC AS STRING
-
- '* No directory, so just the file
- IF szDir$ = "" THEN
- MakePath = szFile$
-
- '* No file, so just the directory
- ELSEIF szFile$ = "" THEN
- MakePath = szDir$
-
- '* Add the two together, no slash necessary
- ELSEIF MID$( szDir$, LEN( szDir$), 1) = "\" THEN
- MakePath = szDir$ + szFile$
-
- '* Add the two together, a slash is necessary
- ELSE
- MakePath = szDir$ + "\" + szFile$
- END IF
- END FUNCTION
-
- '*******************************************************************************
- '* UpdateRegFile
- '*
- '* Fix the OLE reg file to point to the installed EZPHOTO stuff.
- '*******************************************************************************
- SUB UpdateRegFile STATIC
- regfile$ = MakePath(DEST$, "EZPHOTO.REG")
- open regfile$ for append as #1
-
- print #1, "HKEY_CLASSES_ROOT\CLSID\{0002C800-0000-0000-C000-000000000046}\DefaultIcon = " + MakePath(DEST$, "EZPHOTO.EXE") + ",0"
- print #1, "HKEY_CLASSES_ROOT\CLSID\{0002C800-0000-0000-C000-000000000046}\InprocHandler = " + MakePath(DEST$, "HANDLER.DLL")
- print #1, "HKEY_CLASSES_ROOT\CLSID\{0002C800-0000-0000-C000-000000000046}\InprocServer32 = " + MakePath(DEST$, "HANDL32.DLL")
- print #1, "HKEY_CLASSES_ROOT\CLSID\{0002C800-0000-0000-C000-000000000046}\LocalServer = " + MakePath(DEST$, "EZPHOTO.EXE")
- print #1, "HKEY_CLASSES_ROOT\EasyPhoto.Photograph\protocol\StdFileEditing\server = " + MakePath(DEST$, "EZPHOTO.EXE")
- print #1, "HKEY_CLASSES_ROOT\EasyPhoto.Photograph\shell\open\command = " + MakePath(DEST$, "EZPHOTO.EXE") + " %1"
- print #1, "HKEY_CLASSES_ROOT\EasyPhoto.Gallery\shell\open\command = " + MakePath(DEST$, "EZPHOTO.EXE") + " %1"
-
- close #1
-
- cmdLine$ = "REGEDIT /S " + regfile$
- monkey% = WinExec(cmdLine$, 0) '* 0 == SW_HIDE, to hide the window.
-
- '* Insert OLE stuff into the registration database.
- cmdLine$ = "REGEDIT /S " + GetWindowsSysDir + "OLE2.REG"
- monkey% = WinExec(cmdLine$, 0) '* 0 == SW_HIDE, to hide the window.
-
- END SUB
-
-