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<>0 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 16, VerInfo^.dwFileVersionMS and $0000ffff,VerInfo^.dwFileVersionLS shr 16, VerInfo^.dwFileVersionLS and $0000ffff]); end; finally FreeMem(VerBuf,InfoSize); end; end; end;