| 1:2:
 3:
 4:
 5:
 6:
 7:
 8:
 9:
 10:
 11:
 12:
 13:
 14:
 15:
 16:
 17:
 18:
 19:
 20:
 21:
 22:
 23:
 24:
 25:
 26:
 27:
 28:
 29:
 30:
 31:
 32:
 33:
 34:
 35:
 36:
 37:
 38:
 39:
 40:
 41:
 42:
 43:
 44:
 45:
 46:
 47:
 48:
 49:
 50:
 
 | function GetBuildNumber(Filename: string): string;type
 thilo=record
 case integer of
 0: (all:dword);
 1: (lo:word;hi:word);
 end;
 
 var buffer:pointer;
 dummy:cardinal;
 size:cardinal;
 p:pointer;
 data:^vs_FIXEDFILEINFO;
 hilo:thilo;
 lastpointindex:integer;
 begin
 result:='';
 size:=GetFileVersionInfoSize(pchar(filename),dummy);
 GetMem(buffer,size);
 try
 if not GetFileVersionInfo(pchar(application.exename),0,size,buffer) then
 begin
 result := '';
 exit;
 end;
 p:=nil;
 if not VerQueryValue(buffer,pchar(''),p,size) then
 begin
 result := '';
 exit;
 end;
 data:=p;
 hilo.all:=data^.dwFileVersionms;
 result:=IntToStr(hilo.hi);
 result:=result+'.'+IntToStr(hilo.lo);
 hilo.all:=data^.dwFileVersionls;
 result:=result+'.'+IntToStr(hilo.hi);
 result:=result+'.'+IntToStr(hilo.lo);
 finally
 FreeMem(buffer);
 end;
 
 result :=  ReverseString(result);
 lastpointindex := Length(result) - Pos('.',result) + 1;
 result :=  ReverseString(result);
 result := Copy(result,lastpointindex + 1,Length(result) - lastpointindex);
 end;
 |