function GetApplicationVersion:String;  // Added  取得程序版本号
var
FileName:String;
InfoSize,Wnd:DWORD;
VerBuf:Pointer;
VerInfo:^VS_FIXEDFILEINFO;
begin
Result:='0.0.0.0';
FileName:=Application.ExeName;
InfoSize:=GetFileVersionInfoSize(PChar(FileName),Wnd);
if InfoSize<> then
begin
GetMem(VerBuf,InfoSize);
try
if GetFileVersionInfo(PChar(FileName),Wnd,InfoSize,VerBuf) then
begin
VerInfo:=nil;
VerQueryValue(VerBuf,'\',Pointer(VerInfo),Wnd);
if VerInfo<>nil then Result:=Format('%d.%d.%d.%d',[VerInfo^.dwFileVersionMS shr , VerInfo^.dwFileVersionMS and $0000ffff,VerInfo^.dwFileVersionLS shr , VerInfo^.dwFileVersionLS and $0000ffff]);
end;
finally
FreeMem(VerBuf,InfoSize);
end;
end;
end;
05-04 00:57