CString strVersion;
CString strPath(_T("xxxxxxxx.exe"));
// 读文件信息
DWORD dwVerHnd = 0;
DWORD dwVerInfoSize = ::GetFileVersionInfoSize(strPath, &dwVerHnd);
if (dwVerInfoSize)
{
// If we were able to get the information, process it:
HANDLE hMem;
LPVOID lpvMem;
unsigned int uInfoSize = 0;
VS_FIXEDFILEINFO * pFileInfo;
hMem = ::GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
lpvMem = ::GlobalLock(hMem);
::GetFileVersionInfo(strPath, dwVerHnd, dwVerInfoSize, lpvMem);
struct LANGANDCODEPAGE {
WORD wLanguage;
WORD wCodePage;
} *lpTranslate;
// Read the list of languages and code pages.
UINT cbTranslate = sizeof(LANGANDCODEPAGE);
VerQueryValue(lpvMem,
TEXT("\\VarFileInfo\\Translation"),
(LPVOID*)&lpTranslate,
&cbTranslate);
CString strSubBlock;
strSubBlock.Format(_T("\\StringFileInfo\\%04x%04x\\FileDescription"),
lpTranslate->wLanguage, lpTranslate->wCodePage);
char *buffer = NULL;
UINT nSize = 0;
VerQueryValue(lpvMem, strSubBlock, (LPVOID*)&buffer, &nSize);
::GlobalUnlock(hMem);
::GlobalFree(hMem);
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章