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);
}

相关文章:

  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-09
  • 2021-05-17
  • 2021-06-27
  • 2021-09-23
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案