Aquí tienes una función para extraer las diferentes cadenas que aparecen en Proyecto/Opciones/Version..code:
String GetVerStr(String strKey)
{
String strVersion = "(null)"; // Comprobamos si el fichero contiene información de versión
DWORD size = GetFileVersionInfoSize(Application->ExeName.c_str(), NULL);
if (size == 0)
return strVersion;
char *buffer = new char[size];
bool status = GetFileVersionInfo(Application->ExeName.c_str(), NULL, size, buffer);
if (!status)
{
delete[] buffer;
return strVersion;
}
// Extraemos la identificación de lenguaje
UINT datasize;
unsigned short *translation;
VerQueryValue(buffer, "\\VarFileInfo\\Translation", (void**)&translation, &datasize);
// Creamos la cadena de consulta
String key = "\\StringFileInfo\\"
+ String::IntToHex(translation[0], 4)
+ String::IntToHex(translation[1], 4)
+ "\\"
+ strKey;
// Extraemos la información
char *data;
status = VerQueryValue(buffer, key.c_str(), (void**)&data, &datasize);
if (status)
strVersion = data ;
delete[] buffer;
return strVersion;
y para utilizarla, simplemente le das el nombre de la cadena que quieres extraer, por ejemplo:
GetVerStr("FileVersion")
que devolveria algo como esto: 1.0.0.0
Estas son otras cadenas que puedes consultar:
ProductName, ProductVersion, CompanyName, FileDescription, FileVersion, LegalCopyright, Comments, InternalName, LegalTrademarks, OriginalFileName
y también cualquier otra que tu añadas en las opciones.
Saludos.
_Leo