📄 verinfo.h
字号:
/////////////////////////////////////////////////////////////////////////////
/*
DESCRIPTION:
CFileVersionInfo - Class for getting file version information
http://www.codeproject.com/file/VersionInfo.asp
NOTES:
Copyright(C) Armen Hakobyan, 2003
mailto:armen.h@web.am
VERSION HISTORY:
25 Jul 2003 - Posted the article
27 Jul 2003 - Added DLLVERSIONINFO2 support to DllGetVersion
21 Jan 2004 - Added GetFileVersionMajor, GetFileVersionMinor,
GetFileVersionBuild, GetFileVersionQFE functions
29 Jan 2004 - Added GetProductVersionMajor, GetProductVersionMinor,
GetProductVersionBuild, GetProductVersionQFE functions
*/
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include <shlwapi.h>
/////////////////////////////////////////////////////////////////////////////
STDAPI_( HRESULT ) DllGetVersion(IN HMODULE hModule, OUT DLLVERSIONINFO* lpDVI);
/////////////////////////////////////////////////////////////////////////////
typedef enum _VI_CP {
VI_CP_ASCII = 0, // 7-bit ASCII
VI_CP_JAPAN = 932, // Japan (Shift - JIS X-0208)
VI_CP_KOREA = 949, // Korea (Shift - KSC 5601)
VI_CP_TAIWAN = 950, // Taiwan (Big5)
VI_CP_UNICODE = 1200, // Unicode
VI_CP_LATIN2 = 1250, // Latin-2 (Eastern European)
VI_CP_CYRILLIC = 1251, // Cyrillic
VI_CP_MULTILNG = 1252, // Multilingual
VI_CP_GREEK = 1253, // Greek
VI_CP_TURKISH = 1254, // Turkish
VI_CP_HEBREW = 1255, // Hebrew
VI_CP_ARABIC = 1256 // Arabic
} VI_CP;
typedef enum _VI_STR {
VI_STR_COMMENTS = 0, // Comments
VI_STR_COMPANYNAME = 1, // CompanyName
VI_STR_FILEDESCRIPTION = 2, // FileDescription
VI_STR_FILEVERSION = 3, // FileVersion
VI_STR_INTERNALNAME = 4, // InternalName
VI_STR_LEGALCOPYRIGHT = 5, // LegalCopyright
VI_STR_LEGALTRADEMARKS = 6, // LegalTrademarks
VI_STR_ORIGINALFILENAME = 7, // OriginalFilename
VI_STR_PRIVATEBUILD = 8, // PrivateBuild
VI_STR_PRODUCTNAME = 9, // ProductName
VI_STR_PRODUCTVERSION = 10, // ProductVersion
VI_STR_SPECIALBUILD = 11, // SpecialBuild
VI_STR_OLESELFREGISTER = 12 // OLESelfRegister
} VI_STR;
/*
HIWORD( m_vsffi.dwFileVersionMS )
LOWORD( m_vsffi.dwFileVersionMS )
HIWORD( m_vsffi.dwFileVersionLS )
LOWORD( m_vsffi.dwFileVersionLS )
*/
class CFileVersionInfo
{
public: // Construction/destruction:
CFileVersionInfo(void);
virtual ~CFileVersionInfo(void);
public: // Implementation:
BOOL Open(IN LPCTSTR lpszFileName);
BOOL Open(IN HINSTANCE hInstance);
void Close(void);
BOOL QueryStringValue(IN LPCTSTR lpszString, OUT LPTSTR lpszValue, IN INT nBuf) const;
BOOL QueryStringValue(IN INT nIndex, OUT LPTSTR lpszValue, IN INT nBuf) const;
LPCTSTR GetVerStringName(IN INT nIndex) const;
BOOL SetTrans (IN LANGID wLID = LANG_NEUTRAL, IN WORD wCP = VI_CP_UNICODE);
BOOL SetTransIndex(IN UINT nIndex = 0);
INT FindTrans(IN LANGID wLID, IN WORD wCP) const;
DWORD GetTransByIndex(IN UINT nIndex) const;
public: // Static members:
static BOOL GetCPName(IN WORD wCP, OUT LPCTSTR* ppszName);
public: // Inline members
const VS_FIXEDFILEINFO& GetVSFFI(void) const;
BOOL IsValid(void) const;
WORD GetFileVersionMajor(void) const;
WORD GetFileVersionMinor(void) const;
WORD GetFileVersionBuild(void) const;
WORD GetFileVersionQFE(void) const;
WORD GetProductVersionMajor(void) const;
WORD GetProductVersionMinor(void) const;
WORD GetProductVersionBuild(void) const;
WORD GetProductVersionQFE(void) const;
UINT GetTransCount(void) const;
UINT GetCurTransIndex(void) const;
LANGID GetLIDByIndex(IN UINT nIndex) const;
WORD GetCPByIndex(IN UINT nIndex) const;
DWORD GetCurTrans(void) const;
LANGID GetCurLID(void) const;
WORD GetCurCP(void) const;
protected:
BOOL GetVersionInfo(IN LPCTSTR lpszFileName);
BOOL QueryVersionTrans(void);
protected: // Members variables
static LPCTSTR s_ppszStr[13]; // String names
VS_FIXEDFILEINFO m_vsffi; // Fixed File Info (FFI)
// Pointer to version info block (VIB)
LPBYTE m_lpbyVIB;
// Pointer to translation array in m_lpbyVIB, LOWORD = LangID and HIWORD = CodePage
LPDWORD m_lpdwTrans;
// Current translation index
UINT m_nTransCur;
// Translations count
UINT m_nTransCnt;
// Version info is loaded
BOOL m_bValid;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -