Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time Out
Message
From
29/10/2001 14:30:52
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00571751
Message ID:
00574670
Views:
33
>Your idea sounds like the best so far. Can you send me the files? Send it to randall.johnson@novainfo.com
>
>Thanks

I will post it here. Create a file you might name loader.prg, copy the following code, and change constants as appropriate. Create a project, to convert it into an executable:
* Purpose: facilitate software updates (with this program, often it will
* not be necessary for all users to log out).
* This program looks for, and executes, the executable with the highest version number
* (as indicated in the filename)
* Based on a tip (or was it an article?) in FoxPro Advisor.

#DEFINE BASENAME "PCP_"

local lnNumberOfVersions, laExeFileNames(1,1), lnI, lnIndexOfHighest, lnNumberOfHighest,;
	lnCurrentVersionNumber, lcFileName

* Get array with executables
lnNumberOfVersions = adir(laExeFileNames, BASENAME + "*.exe")
if lnNumberOfVersions = 0
	MessageBox("Error: No se encuentra el archivo " + BASENAME + "xxxx.exe.", 16, "Error al cargar el sistema")
	* MessageBox("Error: File not found " + BASENAME + "xxxx.exe.", 16, "Error loading the application")
	return
endif

* Check which one has the highest version number
lnIndexOfHighest = 1
lnNumberOfHighest = 0
for lnI = 1 to alen(laExeFileNames, 1)
	lnCurrentVersionNumber = val(substr(laExeFileNames(lnI, 1), len(BASENAME) + 1))
	if lnCurrentVersionNumber > lnNumberOfHighest
		lnIndexOfHighest = lnI
		lnNumberOfHighest = lnCurrentVersionNumber
	endif
next

* Run the program

lcFileName = laExeFileNames(lnIndexOfHighest, 1)
* ? lcFileName
run /n &lcFileName
wait window "Cargando programa principal, versión #" + transform(lnNumberOfHighest);
	timeout 10
* wait window "Loading main program, version #" + transform(lnNumberOfHighest);
	timeout 10
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform