#pragma comment( lib, "version" )
struct FileVersion
{
	DWORD dwLeftMost;
	DWORD dwSecondLeft;
	DWORD dwSecondRight;
	DWORD dwRightMost;
	bool IsLower( const FileVersion& ver )
	{
		return dwLeftMost < ver.dwLeftMost ? true :
			dwSecondLeft < ver.dwSecondLeft ? true :
			dwSecondRight < ver.dwSecondRight ? true :
			dwRightMost < ver.dwRightMost ? true : false;
	}
};
 
static void GetFileVersion( const CString& fileNameWithPath, FileVersion& fileVersion )
{
	DWORD dwDummy;
	DWORD dwFVISize = GetFileVersionInfoSize( fileNameWithPath , &dwDummy );
	LPBYTE lpVersionInfo = new BYTE[dwFVISize];
	::GetFileVersionInfo( fileNameWithPath , 0 , dwFVISize , lpVersionInfo );
	UINT uLen;
	VS_FIXEDFILEINFO* lpFfi;
	::VerQueryValue( lpVersionInfo , _T("\\") , (LPVOID *)&lpFfi , &uLen );
	DWORD dwFileVersionMS = lpFfi->dwFileVersionMS;
	DWORD dwFileVersionLS = lpFfi->dwFileVersionLS;
	delete[] lpVersionInfo;
	fileVersion.dwLeftMost = HIWORD(dwFileVersionMS);
	fileVersion.dwSecondLeft = LOWORD(dwFileVersionMS);
	fileVersion.dwSecondRight = HIWORD(dwFileVersionLS);
	fileVersion.dwRightMost = LOWORD(dwFileVersionLS);
}