用GetFileVersionInfo和GetFileVersionInfoSize这两个API可以得到版本号信息。GetFileVersionInfo The GetFileVersionInfo function retrieves version information for the specified file. BOOL GetFileVersionInfo( LPTSTR lptstrFilename, // file name DWORD dwHandle, // ignored DWORD dwLen, // size of buffer LPVOID lpData // version information buffer );GetFileVersionInfoSize The GetFileVersionInfoSize function determines whether the operating system can retrieve version information for a specified file. If version information is available, GetFileVersionInfoSize returns the size, in bytes, of that information. DWORD GetFileVersionInfoSize( LPTSTR lptstrFilename, // file name LPDWORD lpdwHandle // set to zero );
从可执行文件中读取版本信息 详细信息 < 文件操作(拷贝,查找,关联,信息) > 从可执行文件中读取版本信息源代码:VersionInfo_demo
可以读取版本号、产品版本、文件版本、公司、版权信息等。[代码性质] VC完整应用程序代码
[代码作者]
[文件大小] 36K
[更新日期] 2002-3-9 12:07:00
[下载次数] 5019
The GetFileVersionInfo function retrieves version information for the specified file. BOOL GetFileVersionInfo(
LPTSTR lptstrFilename, // file name
DWORD dwHandle, // ignored
DWORD dwLen, // size of buffer
LPVOID lpData // version information buffer
);GetFileVersionInfoSize
The GetFileVersionInfoSize function determines whether the operating system can retrieve version information for a specified file. If version information is available, GetFileVersionInfoSize returns the size, in bytes, of that information. DWORD GetFileVersionInfoSize(
LPTSTR lptstrFilename, // file name
LPDWORD lpdwHandle // set to zero
);
http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=204828