[VC]获取本地程序的版本信息信息

 CString CQwerApp::IS_GetAppVersion(char *AppName)
{
////需要加上version.lib在link里
CString AppVersion;
//AppVersion=IS_GetAppCreateTime(AppName); DWORD RessourceVersionInfoSize;
DWORD JustAJunkVariabel;
char* VersionInfoPtr;
struct LANGANDCODEPAGE {
WORD wLanguage;
WORD wCodePage;
} *TranslationPtr;
char* InformationPtr;
UINT VersionInfoSize;
char VersionValue[]; RessourceVersionInfoSize=GetFileVersionInfoSize(AppName,&JustAJunkVariabel);
if(!=RessourceVersionInfoSize)
{
VersionInfoPtr=new char[RessourceVersionInfoSize];
if(GetFileVersionInfo(AppName,,RessourceVersionInfoSize,VersionInfoPtr))
{
if(!VerQueryValue(
VersionInfoPtr,
TEXT("VarFileInfo\\Translation"),
(LPVOID*)&TranslationPtr,
&VersionInfoSize))
{
delete[] VersionInfoPtr;
return AppVersion;
}
} // retrieve File Description
wsprintf(VersionValue,
TEXT(""),
TranslationPtr[].wLanguage,
TranslationPtr[].wCodePage); if(!VerQueryValue(
VersionInfoPtr,
VersionValue,
(LPVOID*)&InformationPtr,
&VersionInfoSize))
{
delete[] VersionInfoPtr;
return AppVersion;
}
if(strlen(InformationPtr)>) //Not Null
{
AppVersion=CString(InformationPtr);
}
delete[] VersionInfoPtr;
}
return AppVersion; }
上一篇:给Qt生成的exe执行程序添加版本信息


下一篇:Agri Net POJ1258 && Constructing Roads POJ2421