how to extract "versioninfo" from sourcecode?
-
i have the following code, it compiles without error, but how can i extract this into a global CString that i can use later for ie in an messagebox or something? i've tried several names in the code but i cant get a hold of them.. //the code string FixedModuleVersion() { char file_name[ MAX_PATH ]; GetModuleFileName( ::GetModuleHandle( NULL ), file_name, MAX_PATH ); DWORD dwDummyHandle; DWORD len = GetFileVersionInfoSize( file_name, &dwDummyHandle ); vector buf( len ); ::GetFileVersionInfo( file_name, 0, len, buf.begin() ); unsigned int ver_length; LPVOID lpvi; ::VerQueryValue( buf.begin(), "\\", &lpvi, &ver_length ); VS_FIXEDFILEINFO fileInfo; fileInfo = *(VS_FIXEDFILEINFO*)lpvi; stringstream s; s <<HIWORD(fileInfo.dwFileVersionMS) <<"." <<LOWORD(fileInfo.dwFileVersionMS) <<"." <<HIWORD(fileInfo.dwFileVersionLS) <<"." <<LOWORD(fileInfo.dwFileVersionLS); return s.str(); } // // This routine will extract the version string from the // string version resource in the RC file for the current module. // Note that you must add version.lib to your project to // link to the Win32 versioning API calls. The actual call // VerQueryValue() uses a value of 040904B0 for the language // and character set. This value is equivalent to English // language text encoded using Unicode. // string StringModuleVersion() { char file_name[ MAX_PATH ]; GetModuleFileName( ::GetModuleHandle( NULL ), file_name, MAX_PATH ); DWORD dwDummyHandle; DWORD len = GetFileVersionInfoSize( file_name, &dwDummyHandle ); vector buf( len ); ::GetFileVersionInfo( file_name, 0, len, buf.begin() ); char *version; unsigned int ver_length; ::VerQueryValue( buf.begin(), "\\StringFileInfo\\040904B0\\FileVersion", (void **) &version, &ver_length ); return string( version, ver_length ); } //end - now how to get hold of something to use?
-
i have the following code, it compiles without error, but how can i extract this into a global CString that i can use later for ie in an messagebox or something? i've tried several names in the code but i cant get a hold of them.. //the code string FixedModuleVersion() { char file_name[ MAX_PATH ]; GetModuleFileName( ::GetModuleHandle( NULL ), file_name, MAX_PATH ); DWORD dwDummyHandle; DWORD len = GetFileVersionInfoSize( file_name, &dwDummyHandle ); vector buf( len ); ::GetFileVersionInfo( file_name, 0, len, buf.begin() ); unsigned int ver_length; LPVOID lpvi; ::VerQueryValue( buf.begin(), "\\", &lpvi, &ver_length ); VS_FIXEDFILEINFO fileInfo; fileInfo = *(VS_FIXEDFILEINFO*)lpvi; stringstream s; s <<HIWORD(fileInfo.dwFileVersionMS) <<"." <<LOWORD(fileInfo.dwFileVersionMS) <<"." <<HIWORD(fileInfo.dwFileVersionLS) <<"." <<LOWORD(fileInfo.dwFileVersionLS); return s.str(); } // // This routine will extract the version string from the // string version resource in the RC file for the current module. // Note that you must add version.lib to your project to // link to the Win32 versioning API calls. The actual call // VerQueryValue() uses a value of 040904B0 for the language // and character set. This value is equivalent to English // language text encoded using Unicode. // string StringModuleVersion() { char file_name[ MAX_PATH ]; GetModuleFileName( ::GetModuleHandle( NULL ), file_name, MAX_PATH ); DWORD dwDummyHandle; DWORD len = GetFileVersionInfoSize( file_name, &dwDummyHandle ); vector buf( len ); ::GetFileVersionInfo( file_name, 0, len, buf.begin() ); char *version; unsigned int ver_length; ::VerQueryValue( buf.begin(), "\\StringFileInfo\\040904B0\\FileVersion", (void **) &version, &ver_length ); return string( version, ver_length ); } //end - now how to get hold of something to use?
Hello, One of these articles should help you: 1) Sven Wiegand's CFileVersionInfo[^] class 2) Eran Yariv, Kenneth Lea's DLL Version[^] 3) Armen Hakobyan's CFileVersionInfo[^] class Best regards, Mihai Moga
-
Hello, One of these articles should help you: 1) Sven Wiegand's CFileVersionInfo[^] class 2) Eran Yariv, Kenneth Lea's DLL Version[^] 3) Armen Hakobyan's CFileVersionInfo[^] class Best regards, Mihai Moga
never mind i got it working thx