Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Edit Version Info Properties Tab

Edit Version Info Properties Tab

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studioquestionannouncement
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pjobson
    wrote on last edited by
    #1

    My version information is stored in MyProject.rc under the VS_VERSION_INFO . I also have a defined variable with the version info as its value that I use for an about section of the program. Is there a short way (maybe only a few lines of code) to set the File's Properties Version Tab to the value of that variable (i.e. change FILEVERSION and PRODUCTVERSION in VS_VERSION_INFO)? Basically so I don't have to go into the VS_VERSION_INFO and change it each time myself. So on build it reads the variable's value and changes the VS_VERSION_INFO automatically...

    D T 2 Replies Last reply
    0
    • P pjobson

      My version information is stored in MyProject.rc under the VS_VERSION_INFO . I also have a defined variable with the version info as its value that I use for an about section of the program. Is there a short way (maybe only a few lines of code) to set the File's Properties Version Tab to the value of that variable (i.e. change FILEVERSION and PRODUCTVERSION in VS_VERSION_INFO)? Basically so I don't have to go into the VS_VERSION_INFO and change it each time myself. So on build it reads the variable's value and changes the VS_VERSION_INFO automatically...

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Something like this, perhaps?


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      P 1 Reply Last reply
      0
      • D David Crow

        Something like this, perhaps?


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        P Offline
        P Offline
        pjobson
        wrote on last edited by
        #3

        No, I don't want it to actually auto increase the version numbers each time i build the executable. I simply want the key (ie FILEVERSION) to read the value of a variable within the code that I define; so I don't physically have to open up the resource file and change the key for the version in VS_VERSION_INFO. You follow what I mean?

        D 1 Reply Last reply
        0
        • P pjobson

          No, I don't want it to actually auto increase the version numbers each time i build the executable. I simply want the key (ie FILEVERSION) to read the value of a variable within the code that I define; so I don't physically have to open up the resource file and change the key for the version in VS_VERSION_INFO. You follow what I mean?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          That article wasn't meant to be a total solution to your problem. It was merely to show you what was invloved in operating on a project's .rc file. Read the first section of this article.


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          P 1 Reply Last reply
          0
          • D David Crow

            That article wasn't meant to be a total solution to your problem. It was merely to show you what was invloved in operating on a project's .rc file. Read the first section of this article.


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            P Offline
            P Offline
            pjobson
            wrote on last edited by
            #5

            I appreciate the help. I'll see what I can do with what I've read.

            1 Reply Last reply
            0
            • P pjobson

              My version information is stored in MyProject.rc under the VS_VERSION_INFO . I also have a defined variable with the version info as its value that I use for an about section of the program. Is there a short way (maybe only a few lines of code) to set the File's Properties Version Tab to the value of that variable (i.e. change FILEVERSION and PRODUCTVERSION in VS_VERSION_INFO)? Basically so I don't have to go into the VS_VERSION_INFO and change it each time myself. So on build it reads the variable's value and changes the VS_VERSION_INFO automatically...

              T Offline
              T Offline
              tlerner
              wrote on last edited by
              #6

              I just implemented this...try this... This belongs in your Init for your Help or About Dlg. edit: the tabs didnt come out to well, but you can adjust! CString szAllRights = _T( "All Rights Reserved." ); CString szAppVersion; CString szComments; CString szCopyright; CString szCopyrightWarning; CString szCompanyName; CString szAppName = _T( "AppName.exe" ); DWORD dwVerInfoSize; // Size of version information block DWORD dwVerHnd = 0; // An 'ignored' parameter, always '0' dwVerInfoSize = GetFileVersionInfoSize( (WCHAR*)(const WCHAR*)szAppName, &dwVerHnd ); if ( dwVerInfoSize ) { HANDLE hMem; if ( ( hMem = GlobalAlloc( GMEM_MOVEABLE, dwVerInfoSize ) ) != NULL ) { LPSTR lpstrVffInfo; lpstrVffInfo = (char *)GlobalLock( hMem ); if ( GetFileVersionInfo( (WCHAR*)(const WCHAR*)szAppName, dwVerHnd, dwVerInfoSize, lpstrVffInfo ) ) { LPWSTR lpVerInfo; // String pointer to version information text UINT lpVerInfoLen; // Version information text string length. // File Version if ( VerQueryValue( (LPVOID)lpstrVffInfo, TEXT( "\\StringFileInfo\\040904B0\\FileVersion" ), (LPVOID*)&lpVerInfo, &lpVerInfoLen ) ) { szAppVersion = _T( "Version "); szAppVersion += lpVerInfo; SendMessage( GetDlgItem( IDC_VER ), WM_SETTEXT, NULL, (LPARAM)szAppVersion.GetBuffer(MAX_PATH) ); } else SendMessage( GetDlgItem( IDC_VER ), WM_SETTEXT, NULL, (LPARAM)_T("") ); } } GlobalUnlock( hMem ); GlobalFree( hMem ); You need a IDC_VER in your dialog that you want to display that information into. You can also get the strings from other parts of the versioning by using the following: // Copyright VerQueryValue( (LPVOID)lpstrVffInfo, TEXT( "\\StringFileInfo\\040904B0\\LegalCopyright" ), (LPVOID*)&lpVerInfo, &lpVerInfoLen ) VerQueryValue( (LPVOID)lpstrVffInfo, TEXT( "\\StringFileInfo\\040904B0\\CompanyName" ), (LPVOID*)&lpVerInfo, &lpVerInfoLen ) Hope this helps

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups