2008-11-25 45 views

回答

3

當您查看通過資源編輯器的版本信息,您可能會注意到,有一個初始段與FILEVERSION,PRODUCTVERISON等,然後一個或多個包含語言特定設置的塊。

VS_VERSION_INFO VERSIONINFO 
FILEVERSION 5,0,0,0 
PRODUCTVERSION 5,0,0,0 
FILEFLAGSMASK 0x3fL 
#ifdef _DEBUG 
FILEFLAGS 0x1L 
#else 
FILEFLAGS 0x0L 
#endif 
FILEOS 0x40004L 
FILETYPE 0x2L 
FILESUBTYPE 0x0L 
BEGIN 
    BLOCK "StringFileInfo" 
    BEGIN 
     BLOCK "040904b0" 
     BEGIN 
      VALUE "CompanyName", "" 
      VALUE "FileVersion", "5, 0, 0, 0" 
      VALUE "ProductName", "" 
      VALUE "ProductVersion", "5, 0, 0, 0" 
     END 
     BLOCK "000004b0" 
     BEGIN 
      VALUE "CompanyName", "" 
      VALUE "FileVersion", "5, 0, 0, 0" 
      VALUE "ProductName", "" 
      VALUE "ProductVersion", "5, 0, 0, 0" 
     END 
    END 
    BLOCK "VarFileInfo" 
    BEGIN 
     VALUE "Translation", 0x0, 1200, 0x409, 1200 
    END 
END 

爲了得到一個VS_FIXEDFILEINFO與非語言具體細節使用

VS_FIXEDFILEINFO *versionInfo; 
PUINT versionInfoSize; 
VerQueryValue(buffer.get(), TEXT("\\"), (void**) &versionInfo, &versionInfoSize)) 

要了解所支持的語言使用

Var *translationsInfo; 
PUINT transaltionInfoSize; 
VerQueryValue(buffer.get(), TEXT("\\VarFileInfo\\Translation"), (void**) &translationsInfo, &transaltionInfoSize)) 

要獲得特定語言版本細節,然後使用

StringTable *stringTable; 
PUINT stringTableSize; 
std::wstring path(L"\\StringFileInfo\\"); 
path += L"040904b0"; // get this value from the language support list 
path += L"\\FileVersion"; 
VerQueryValue(buffer.get(), path.c_str(), (void**) &stringTable, &stringTableSize)) 
相關問題