Possible Duplicate:
How do I read from a version resource in Visual C++
I add a ressource "version" to my C++ Visual Studio project and now I want to read back this value in my code!
How is this possible?
Thx
Possible Duplicate:
How do I read from a version resource in Visual C++
I add a ressource "version" to my C++ Visual Studio project and now I want to read back this value in my code!
How is this possible?
Thx
You access the resource with the function FindResource and access it with the function LoadResource. At the second like you will also get a complete example to access and update the resource.
Here's how I do it in Project: Merge:
std::wstring ReadProcessVersion( const std::wstring& filename )
{
char buffer[ 8192 ];
wchar_t* version;
UINT size;
if( GetFileVersionInfo( filename.c_str(), NULL, sizeof( buffer ), buffer ))
{
if( VerQueryValue( buffer, L"\\StringFileInfo\\080904B0\\FileVersion", reinterpret_cast< void** >( &version ), &size ))
{
return version;
}
}
return L"";
}
If I remember rightly, the resource identifier 080904B0
is locale dependent. (I only ever have English.)