Edit Version Info Properties Tab
-
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...
-
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...
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
-
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
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?
-
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?
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
-
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
-
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...
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