C++ 如何读取文件的版本信息
有些时候,我们需要知道程序调用的库或者某个exe文件的版本信息(或其他相关属性信息时)。这时就需要考虑到如何去读取这些文件的版本信息呢?
从万能的网上查到了VerQueryValue函数,可以实现我们的需求。
说明:在使用VerQueryValue函数之前,必须先使用GetFileVersionInfoSize和GetFileVersionInfo这两个函数。
1.函数说明
/* Returns size of version info in bytes */
DWORD
APIENTRY
GetFileVersionInfoSizeA(
__in LPCSTR lptstrFilename, /* Filename of version stamped file */
__out_opt LPDWORD lpdwHandle
); /* Information for use by GetFileVersionInfo */
DWORD
APIENTRY
GetFileVersionInfoSizeA(
__in LPCSTR lptstrFilename, /* Filename of version stamped file */
__out_opt LPDWORD lpdwHandle
); /* Information for use by GetFileVersionInfo */
/* Read version info i