Hi All.
Does anyone know whether it is possible to save (at compile time) and extract (at runtime) the program version in WinCE as I use it currently in Win32 and Win64 ?
It appears that the same code doesn't work. There is the code snippet I use:

function ReadVersionInfo(const sProgram: string; Out vv: PTVersion) :Boolean;
var
  Info:       PVSFixedFileInfo;
  InfoSize:   Cardinal;
  nHwnd:      DWORD;
  BufferSize: DWORD;
  Buffer:     Pointer;
begin
  ZeroMemory(Info, SizeOF(PVSFixedFileInfo));
  vv := new(PTVersion);
  InfoSize := 0;
  nHwnd := 0;
  with vv^ do begin
    Major:= -1;
    Minor := 0;
    Release := 0;
    Build := 0;
  end;
  Result := False; //no version info at all in the file
BufferSize := GetFileVersionInfoSize(pchar(sProgram), nHWnd); {Get buffer size}
  if BufferSize <> 0 then begin //if zero, there is no version info
    Buffer := nil;
    ReAllocMem(Buffer, BufferSize+1);
    try
if GetFileVersionInfo(PChar(sProgram),nHWnd,BufferSize,Buffer) then begin // got version info if VerQueryValue(Buffer, PChar('\'), Pointer(Info), InfoSize) then begin //got root block version information
          with vv^ do begin
            Major := HiWord(Info^.dwFileVersionMS); //extract major version
            Minor := LoWord(Info^.dwFileVersionMS); //extract minor version
Release := HiWord(Info^.dwFileVersionLS); //extract release version
            Build := LoWord(Info^.dwFileVersionLS); //extract build version
          end;
          Result := True;
        end
      end
    finally
      ReAllocMem(Buffer, 0);
    end
  end;
end;

Thanks,
Antonio.



--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to