I need to get the version info of a dll I created in VS2008 C++. How do I get it?
Thanks,
Adam
I need to get the version info of a dll I created in VS2008 C++. How do I get it?
Thanks,
Adam
It should be there in the properties (version tab) when you open it in windows explorer
If you want programmatic access, see Version Information in MSDN for the APIs and data structures you need.
Looks like you need to access the VS_VERSION_INFO resource; http://www.microsoft.com/msj/0498/c0498.aspx
Thanks for the answers.
This worked for me:
WCHAR fileName[_MAX_PATH];
DWORD size = GetModuleFileName(g_dllHandle, fileName, _MAX_PATH);
fileName[size] = NULL;
DWORD handle = 0;
size = GetFileVersionInfoSize(fileName, &handle);
BYTE* versionInfo = new BYTE[size];
if (!GetFileVersionInfo(fileName, handle, size, versionInfo))
{
delete[] versionInfo;
return;
}
// we have version information
UINT len = 0;
VS_FIXEDFILEINFO* vsfi = NULL;
VerQueryValue(versionInfo, L"\\", (void**)&vsfi, &len);
aVersion[0] = HIWORD(vsfi->dwFileVersionMS);
aVersion[1] = LOWORD(vsfi->dwFileVersionMS);
aVersion[2] = HIWORD(vsfi->dwFileVersionLS);
aVersion[3] = LOWORD(vsfi->dwFileVersionLS);
delete[] versionInfo;