` Printed Icetips Article

Icetips Article



Par2: Get version number from Version Resource Template
2005-08-15 -- Brent Stock
 
If you are referring to information from the cwVersionRes template, I have 
written a little extension to get date/version/build version information and to 
make it available at runtime.  This allows you to use the global variables 
where ever you want in your code - splash, about, window title etc.

Note: I put the a version date called "Date of Build" into the verUserValue1 
field from the cwVersionRes template to help keep track of that as well.

Here is my template - use it if you find it valuable, ignore it if not.  Note 
this is written for a specific application called PRISM so you may want to 
change the variable names to suit yourself.  I use it "as is" in other apps 
(the name does not matter to the app) and just keep the PRISM name, either way, 
it WORKS!

#!-----------------------------------------------------------------------
#EXTENSION(PRISMInformation,'PRISM Information'),PROCEDURE
#!-----------------------------------------------------------------------
#DISPLAY('Brent H. Stock')
#DISPLAY('')
#BOXED('Title:')
#PROMPT('Variable:',FIELD),%PRISMTitleField
#ENABLE(%PRISMTitleField)
#PROMPT('Value:',@s50),%PRISMTitle,REQ
#ENDENABLE
#ENDBOXED
#BOXED('Version:')
#PROMPT('Variable:',FIELD),%PRISMVersionField
#ENABLE(%PRISMVersionField)
#PROMPT('Use Version Information?',CHECK),%PRISMVersionCheck,AT(10)
#ENABLE(NOT %PRISMVersionCheck)
#PROMPT('Value:',@s10),%PRISMVersion,REQ
#ENDENABLE
#ENDENABLE
#ENDBOXED
#BOXED('Date Changed:')
#PROMPT('Variable:',FIELD),%PRISMDateField
#ENABLE(%PRISMDateField)
#PROMPT('Use Version Information Date?',CHECK),%PRISMDateCheck,AT(10)
#ENABLE(~%PRISMDateCheck)
#PROMPT('Use Today?',CHECK),%PRISMDateToday,AT(10)
#ENABLE(~%PRISMDateToday)
#PROMPT('Value:',@d17),%PRISMDate
#ENDENABLE
#ENDENABLE
#ENDENABLE
#ENDBOXED
#BOXED('Build:')
#PROMPT('Variable:',FIELD),%PRISMBuildField
#ENABLE(%PRISMBuildField)
#PROMPT('Use Version Information Build?',CHECK),%PRISMBuildCheck,AT(10)
#ENABLE(NOT %PRISMBuildCheck)
#PROMPT('Value:',@s10),%PRISMBuild
#DISPLAY('BUILD# changes automatically on each day of build')
#ENDENABLE
#ENDENABLE
#ENDBOXED
#!-----------------------------------------------------------------------
#AT(%WindowManagerMethodCodeSection,'Init','(),BYTE'),PRIORITY(0)
  #IF(%PRISMTitleField)
%PRISMTitleField='%PRISMTitle'
  #ENDIF
  #IF(%PRISMVersionField)
    #IF(%PRISMBuildCheck)
#IF(%CWVersion>=6000)
%PRISMVersionField='%verProdMajVer.%(FORMAT(((%verProdMinVer*10)+%verProdSubVer),@N02))'
#!%PRISMVersionField='%verProdMajVer.%verProdMinVer.%verProdSubVer'
#ELSE
%PRISMVersionField='%VIFileVersionMH.%(FORMAT(%VIFileVersionML,@N02))'
#END
    #ELSE
%PRISMVersionField='%PRISMVersion'
    #ENDIF
  #ENDIF
  #IF(%PRISMDateField)
    #IF(%PRISMDateCheck)
#IF(%CWVersion>=6000)
      #SET(%PRISMDate,DEFORMAT(%verUserValue1,@D17))
#ELSE
      #SET(%PRISMDate,%ProgramDateChanged)
#ENDIF
    #ELSE
        #IF(%PRISMDateToday)
          #SET(%PRISMDate,%ProgramDateChanged)
        #ENDIF
    #ENDIF
%PRISMDateField=%PRISMDate !%(FORMAT(%PRISMDate,@D17))
  #ENDIF
  #IF(%PRISMBuildField)
    #IF(%PRISMBuildCheck)
#IF(%CWVersion>=6000)
      #SET(%PRISMBuild,%verProdBuildNo)
#ELSE
      #SET(%PRISMBuild,%VIFileVersionLH*1000+%CurrentBuildNumber)
#ENDIF
    #ELSE
      #SET(%PRISMBuild,%ProgramDateChanged-72322)
    #ENDIF
%PRISMBuildField='%PRISMBuild'
  #ENDIF
#ENDAT



Printed November 23, 2024, 6:15 pm
This article has been viewed/printed 35231 times.