Article View: borland.public.cppbuilder.nativeapi
Article #16462Re: GetFileVersionInfo
From: Pere Mateu
Date: Tue, 13 May 2003 19:54
Date: Tue, 13 May 2003 19:54
26 lines
1846 bytes
1846 bytes
Hope this helps,
AnsiString __fastcall GetFileVersion(AnsiString FileName)
{
int i; unsigned long j; bool b=false;
unsigned int Major, Minor; AnsiString s="";
i=GetFileVersionInfoSize(FileName.c_str(),&j);
if (i>0) {
char *buff=StrAlloc(i+1);
if (GetFileVersionInfo(FileName.c_str(),j,i,buff)) {
void* ffi; unsigned int k;
if (VerQueryValue(buff,"\\",&ffi,&k)) {
Major=((VS_FIXEDFILEINFO*)ffi)->dwFileVersionMS;
Minor=((VS_FIXEDFILEINFO*)ffi)->dwFileVersionLS;
b=true;
}
}
StrDispose(buff);
}
if (b) s=IntToStr(Major/65536)+"."+(Major%65536)+"."+
IntToStr(Minor/65536)+"."+(Minor%65536);
return(s);
}
Regards,
P. Mateu
Technical Details
Message-ID:
<3ec14d8a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeeds.sol.net!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ec12c4e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,7c3f93e98f15788a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-13 13:24:38 PST From: "Pere Mateu" <pmateu@ono.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ec12c4e@newsgroups.borland.com> Subject: Re: GetFileVersionInfo Date: Tue, 13 May 2003 21:54:50 +0200 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 81.202.193.79 Message-ID: <3ec14d8a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1052855690 81.202.193.79 (13 May 2003 12:54:50 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeeds.sol.net!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail