全部博文(788)
分类:
2008-10-14 16:38:58
function GetFileVersion(FileName : String): String;
var
InfoSize, Wnd: DWORD;
VerBuf: Pointer;
FI: PVSFixedFileInfo;
VerSize: DWORD;
begin
Result := '';
InfoSize := GetFileVersionInfoSize(PChar(FileName), Wnd);
if InfoSize <> 0 then
begin
GetMem(VerBuf, InfoSize);
try
if GetFileVersionInfo(PChar(FileName), Wnd, InfoSize, VerBuf) then
if VerQueryValue(VerBuf, '\', Pointer(FI), VerSize) then
begin
Result := InttoStr(FI.dwFileVersionMS div $FFFF);
Result := Result+'.'+InttoStr(FI.dwFileVersionMS mod $10000);
Result := Result+'.'+InttoStr(FI.dwFileVersionLS div $FFFF);
Result := Result+'.'+InttoStr(FI.dwFileVersionLS mod $10000);
end;
finally
FreeMem(VerBuf);
end;
end;
end;
procedure TAboutForm.FormCreate(Sender: TObject);
var
strTemp,FileName: String;
begin
FileName := Application.EXEName+chr(0);
strTemp := GetFileVersion(FileName);
if strTemp<>'' then
Label1.Caption := '(V'+strTemp+')';
end;
来晚了。接分。
ding
用Raize组件的TRzVersionInfoStatus