Skip to content

Instantly share code, notes, and snippets.

View superlucky8848's full-sized avatar

superlucky superlucky8848

  • SuperLucky Works
View GitHub Profile
@superlucky8848
superlucky8848 / GetFileVersion.cpp
Created April 4, 2016 02:25
C++ Get file version and return formatted string(Windows)
#pragma comment(lib,"Version.lib")
#define MAX_LINE_LENGTH 4096
CString GetFileVersion(LPCTSTR filePath)
{
CString ret(_T(""));
DWORD dummy;
DWORD dwSize = GetFileVersionInfoSize(filePath, &dummy);
if (dwSize == 0) ret = _T("Error retriving version(Module Not Found)");