This.ReleaseSplash() ENDIF *-------------------------------------------- *--- Check the version information *-------------------------------------------- IF This.lCheckVersion IF !This.Checkversion() RETURN .F. ENDIF ENDIFIn the CheckVersion method, insert the following:
LOCAL lcEXE, lcLocalSTF, lcRemoteSTF, lnLocalHandle, lcLocalVersion, ; ltLocalVersion, lnRemoteHandle, lcRemoteVersion, ltRemoteVersion, ; lcRemoteSetup, lcOldDefault IF VERSION(2) <> 0 RETURN .T. ENDIF CREATE CURSOR stfcursor (cText C(65)) *-------------------------------------------------------- *--- Get a reference to the Local STF file *-------------------------------------------------------- lcEXE = SYS(16,0) IF VERSION(2) <> 0 lcLocalSTF = getfile("STF", "Open STF file") ELSE lcLocalSTF = ADDBS(JUSTPATH(lcEXE))+"Setup\Setup.stf" ENDIF *-------------------------------------------------------- *--- Open the local STF file and grab the second line *-------------------------------------------------------- IF FILE(lcLocalSTF) APPEND FROM &lcLocalSTF TYPE SDF REPLACE ALL cText WITH STRTR(cText, CHR(9),"-") GO TOP SKIP lcLocalVersion = stfcursor.cText *-------------------------------------------------------- *--- Get a reference to the Source STF file *-------------------------------------------------------- GOTO 10 lcRemoteSTF = ; ALLTRIM(SUBSTR(stfcursor.cText, AT("-", stfcursor.cText)+1)) lcRemoteSTF = LEFT(lcRemoteSTF, RAT("\", lcRemoteSTF))+ "Setup.stf" ZAP ELSE =ERRORMSG("Local setup file not found") RETURN .F. ENDIF *-------------------------------------------------------- *--- Parse the datetime info out of the string *-------------------------------------------------------- lcLocalVersion = SUBSTR(lcLocalVersion, 13) ltLocalVersion = CTOT(SUBSTR(lcLocalVersion,6,2)+"/"+; SUBSTR(lcLocalVersion,9,2)+"/"+LEFT(lcLocalVersion,4)+" "+ ; SUBSTR(lcLocalVersion,12,8)) *-------------------------------------------------------- *--- Open the remote STF file and grab the second line *-------------------------------------------------------- IF FILE(lcRemoteSTF) APPEND FROM &lcRemoteSTF TYPE SDF REPLACE ALL cText WITH STRTR(cText, CHR(9),"-") GO TOP SKIP lcRemoteVersion = stfcursor.cText ELSE =ERRORMSG("Remote setup file not found") RETURN .F. ENDIF *-------------------------------------------------------- *--- Parse the datetime info out of the string *-------------------------------------------------------- lcRemoteVersion = SUBSTR(lcRemoteVersion, 13) ltRemoteVersion = CTOT(SUBSTR(lcRemoteVersion,6,2)+"/"+; SUBSTR(lcRemoteVersion, 9,2)+"/"+LEFT(lcRemoteVersion,4)+" "+ ; SUBSTR(lcRemoteVersion,12,8)) *-------------------------------------------------------- *--- Compare the two time stamps and run the setup if the *--- user chooses to. *-------------------------------------------------------- IF ltRemoteVersion > ltLocalVersion lcRemoteSetup = ADDBS(JUSTPATH(lcRemoteSTF)) + "Setup.exe /Q" IF YesNo("A later version of this application is available. Do you wish to upgrade?") RUN &lcRemoteSetup ENDIF RETURN .F. ELSE RETURN .T. ENDIF