Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

How to run App with right Version / SP
Lutz Scheffler, June 2, 2009
A commonly problem seems to be to run an app with the VFP Version / SP it is compiled. VFP itself gives not much help on this. But some little compiler commands like #IF and #DEFINES will do the trick.
Summary
A commonly problem seems to be to run an app with the VFP Version / SP it is compiled. VFP itself gives not much help on this. But some little compiler commands like #IF and #DEFINES will do the trick.
Description
Place on top of your Main Program the following code:
*work for the compiler (might be in some header file):
#IF VERSION(5)<800 THEN
 #DEFINE dnVersion7_Prog					'YES'
* Older then Version  8.00
#ENDIF &&VERSION(5)<800
#IF VERSION(5)<900 THEN
 #DEFINE dnVersion8_Prog					'YES'	
* Older then Version  9.00
#ENDIF &&VERSION(5)<900
#IF VERSION(5)<1000 THEN
 #DEFINE dnVersion9_Prog					'YES'	
* Older then Version 10.00
 #IF RIGHT(VERSION(4),4)='7423' THEN
*SP2 KB968409
  #DEFINE dcV9SP							'7423'
 #ELSE &&RIGHT(VERSION(4),4)='7423'
  #IF RIGHT(VERSION(4),4)='5815' THEN
*SP2
   #DEFINE dcV9SP							'5815'
  #ELSE &&RIGHT(VERSION(4),4)='5815'
   #IF RIGHT(VERSION(4),4)='3504' THEN
    #DEFINE dcV9SP							'3504'
   #ELSE &&RIGHT(VERSION(4),4)='3504'
*VFP9 vanilla
    #DEFINE dcV9SP							'2412'
   #ENDIF &&RIGHT(VERSION(4),4)='3504'
  #ENDIF &&RIGHT(VERSION(4),4)='5815'
 #ENDIF &&RIGHT(VERSION(4),4)='7423'
#ENDIF &&VERSION(5)<1000

*runtime code (need to be in the main prog)
#IFDEF dnVersion7_Prog THEN
 IF VERSION(5)>799 THEN
  MESSAGEBOX('Falsche Version',MB_IconInformation)
  RETURN .F.
 ENDIF &&VERSION(5)>799
#ELSE &&dnVersion7_Prog
 #IFDEF dnVersion8_Prog THEN
  IF !BETWEEN(VERSION(5),800,899) THEN
   MESSAGEBOX('Wrong Version")
   RETURN .F.
  ENDIF &&!BETWEEN(VERSION(5),800,899)
 #ELSE &&dnVersion8_Prog
  #IFDEF dnVersion9_Prog THEN
   IF !BETWEEN(VERSION(5),900,999) THEN
    MESSAGEBOX(''Wrong Version") 
    RETURN .F.
   ENDIF &&!BETWEEN(VERSION(5),900,999)
   IF !RIGHT(VERSION(4),4)==dcV9SP THEN
    MESSAGEBOX("Wrong Servicepack")
    RETURN .F.
   ENDIF &&!RIGHT(VERSION(4),4)==dcV9SP

  #ENDIF &&dnVersion9_Prog
 #ENDIF &&dnVersion8_Prog
#ENDIF &&dnVersion7_Prog
Lutz Scheffler, Lutz Scheffler Software Ingenieurbüro
More articles from this author
Lutz Scheffler, May 8, 2009
When printing, sometimes there is a need to know if a report is printed or not. Since we have no simple way to see if something is realy printed we can at least check if the user send a complete report to the spooler. This article deals with the way to solve this problem with and without object as...
Lutz Scheffler, June 4, 2004
Custom scripts are different from scripts that are invoked via a command or function. The big plus to command or function is that custom scripts may invoke everywhere in a line, while command can be invoked only as first word and functions need a "(". There are some problems to write a custom scr...