Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DLL file version

I have an application that uses a DLL to generate fastReports files.

When I need to make changes to the reports data structure I only change this DLL and distribute it to all user of the APP. How can I guarantee that all have the last version before they start?

How can I generate/Extract this information from the DLL file.

like image 331
DRokie Avatar asked Apr 19 '11 20:04

DRokie


People also ask

How do I find the dll version?

If you reference the dll in Visual Studio right click it (in ProjectName/References folder) and select "Properties" you have "Version" and "Runtime Version" there. In File Explorer when you right click the dll file and select properties there is a "File Version" and "Product Version" there.

What is version dll used for?

dll (Version Checking and File Installation) – Details. The file version. dll contains program code used by windows to perform version checking on other libraries and other supporting files.

How do I check the version of a file?

You can use the FileVersionInfo. FileVersion property with the Get-Command to get the file version in PowerShell. The following command gets the file version number of a file C:\Windows\System32\ActionCenter. dll .


1 Answers

This function will get the fileversion as string:

function FileVersionGet( const sgFileName : string ) : string;
var infoSize: DWORD;
var verBuf:   pointer;
var verSize:  UINT;
var wnd:      UINT;
var FixedFileInfo : PVSFixedFileInfo;
begin
  infoSize := GetFileVersioninfoSize(PChar(sgFileName), wnd);

  result := '';

  if infoSize <> 0 then
  begin
    GetMem(verBuf, infoSize);
    try
      if GetFileVersionInfo(PChar(sgFileName), wnd, infoSize, verBuf) then
      begin
        VerQueryValue(verBuf, '\', Pointer(FixedFileInfo), verSize);

        result := IntToStr(FixedFileInfo.dwFileVersionMS div $10000) + '.' +
                  IntToStr(FixedFileInfo.dwFileVersionMS and $0FFFF) + '.' +
                  IntToStr(FixedFileInfo.dwFileVersionLS div $10000) + '.' +
                  IntToStr(FixedFileInfo.dwFileVersionLS and $0FFFF);
      end;
    finally
      FreeMem(verBuf);
    end;
  end;
end;
like image 117
Matthias Alleweldt Avatar answered Sep 20 '22 23:09

Matthias Alleweldt