Announcement

Collapse
No announcement yet.

Placing version number in EXE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Placing version number in EXE

    I've done some looking but haven't found a description of how version numbers/build numbers are handled in EXE's.

    When programs look inside an EXE to get a version number, how did the version number get placed there in the first place?

    I've seen resource file examples with version information, but is that the same as the EXE version number?

    Can someone clarify how this works?

  • #2
    It's done with a program resource.

    example
    Code:
    //  FILENAME.RC 
    
    #include "resource.h"
    
    #define COPYRIGHT_SYMBOL "\251"
    #define REGISTERED_SYMBOL "\256"
    #define TRADEMARK_SYMBOL  "\231"
    
    
    #define VERSION_MAJOR   1
    #define VERSION_MINOR   2
    #define VERSION_BUILD   0
    #define VERSION_LITERAL   "1.2.0\0"
    #define VERSION_DATE      "August 12 2008\0"
    #define VERSION_DESC      "Control Orbiter Monitor\0"
    #define VERSION_COPYRIGHT "\251 2008 Michael C. Mattias Racine WI\0"
    #define VERSION_TRADEMARK "None\0"
    ....
    
    // STANDARD VERSION RESOURCE
    
    VS_VERSION_INFO VERSIONINFO
    FILEVERSION      VERSION_MAJOR, VERSION_MINOR, 0, VERSION_BUILD
    PRODUCTVERSION   VERSION_MAJOR, VERSION_MINOR, 0, VERSION_BUILD
    FILEOS VOS_WINDOWS32
    FILETYPE VFT_APP
    //* VFT_DLL FOR DLLs
    BEGIN
      BLOCK "StringFileInfo"
      BEGIN
        BLOCK "040904E4"
        BEGIN
          VALUE "CompanyName",      "Tal Systems Inc.\0"
          VALUE "FileDescription",  VERSION_DESC
          VALUE "FileVersion",      VERSION_LITERAL
          VALUE "InternalName",     "ptmncom\0"
          VALUE "OriginalFilename", "ptmncom\0"
          VALUE "LegalCopyright",   VERSION_COPYRIGHT
          VALUE "LegalTrademarks",  VERSION_TRADEMARK
          VALUE "ProductName",      "PTMNEDI\0"
          VALUE "ProductVersion",   VERSION_LITERAL
          VALUE "Comments",         "none\0"
          VALUE "Author",           "Michael Mattias Racine WI USA\0"
          VALUE "VersionDate",       VERSION_DATE
        END
      END
    END
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Oops, BTW...
      Code:
      FILEVERSION      VERSION_MAJOR, VERSION_MINOR, 0, VERSION_BUILD
      PRODUCTVERSION   VERSION_MAJOR, VERSION_MINOR, 0, VERSION_BUILD
      This is NOT Windows standard; this is:
      Code:
      FILEVERSION      VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_SUBBUILD
      PRODUCTVERSION   VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_SUBBUILD
      i.e,
      Code:
      FILEVERSION      1, 2, 3, 4
      Will display "1,2,3,4" when done "the Windows way" (eg via Explorer).

      All my versions display "X.Y.0.Z" via Windows, but in my programs they display "X.Y.Z"

      (Don't ask. And yes it's on "the list" for me to change. Some day.)

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        The version block Michael posted is incomplete. See my post in the following thread to see why.
        http://www.powerbasic.com/support/pb...StringFileInfo
        Dominic Mitchell
        Phoenix Visual Designer
        http://www.phnxthunder.com

        Comment


        • #5
          >The version block Michael posted is incomplete

          Right you are, caught me posting an old one... that VarfileInfo part I only added recently.

          MCM
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment

          Working...
          X