Board index » cppbuilder » Re: version number in ptoject
Keith
![]() CBuilder Developer |
Re: version number in ptoject2005-01-19 12:57:17 AM cppbuilder48 Darío Alejandro Guzik wrote: QuoteHi! String __fastcall TForm6::VersionInfo(const String &sQuery) { DWORD c; DWORD dw=0; UINT ui; char *p; LPVOID ptr; String sOut=ParamStr(0); ///ParamStr(0) holds exe name c = GetFileVersionInfoSize(ParamStr(0).c_str(), &dw); p = new char[c + 1]; //file://create the space GetFileVersionInfo(ParamStr(0).c_str(),0,c,p);//get the version info data // Extract the language/translation information... VerQueryValue(p, TEXT("\\VarFileInfo\\Translation"), &ptr, &ui); // ptr comes back as a ptr to two (16-bit) words containing the two halves of // the translation number required for StringFileInfo WORD *id=(WORD*)ptr; String sBase = String("\\StringFileInfo\\")+ IntToHex(id[0],4) + IntToHex(id[1],4) + "\\"; String qs = sBase + sQuery ; // query string VerQueryValue(p, qs.c_str(), &ptr, &ui); sOut = (char*)ptr; delete [] p; return sOut; } //--------------------------------------------------------------------------- void __fastcall TForm6::FormActivate(TObject *Sender) { String Caption=VersionInfo("LegalCopyright"); String ProductName=VersionInfo("ProductName"); String FileVersion=VersionInfo("FileVersion"); : use as desired... : } //--------------------------------------------------------------------------- |