Link to home
Start Free TrialLog in
Avatar of mr76
mr76

asked on

Please Look at this code!!!

function TfrmAbout.GetProgramVersion(path : string) : string;
var
   nZero,nSize : integer;
   lpData      : pointer;
   p           : pointer;
begin
 result:='Unknown';
 nSize:=GetFileVersionInfoSize(pchar(path),nZero);
 if nSize>0 then
  begin
   getmem(lpData,nSize);
   if GetFileVersionInfo(pchar(path),0,nSize,lpData) then
    if VerQueryValue(lpData,'\',p,nZero) then
     begin
     result:=inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionMS shr 16)+'.'+
             inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionMS and $FFFF)+'.'+
             inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionLS shr 16)+'.'+
             inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionLS and $FFFF);
     end;
   freemem(lpData,nSize);
  end;
end;

When I compile this functin I get
'Types of actual and formal var parameters must be identical'. On line 2 and 7.

Thanks
mr76
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It should be like this

function TForm1.GetProgramVersion(path : string) : string;
var
   nZero,nSize : DWORD;
   lpData      : pointer;
   p           : pointer;
begin
 result:='Unknown';
 nSize:=GetFileVersionInfoSize(pchar(path),nZero);
 if nSize>0 then
  begin
   getmem(lpData,nSize);
   if GetFileVersionInfo(pchar(path),0,nSize,lpData) then
    if VerQueryValue(lpData,'\',p,nZero) then
     begin
     result:=inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionMS shr 16)+'.'+
             inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionMS and $FFFF)+'.'+
             inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionLS shr 16)+'.'+
             inttostr(tVSFIXEDFILEINFO(p^).dwFileVersionLS and $FFFF);
     end;
   freemem(lpData,nSize);
  end;
end;


Heath
Or as inthe stated, cardinal will work too :)

Heath
listenning
Avatar of BlackDeath
BlackDeath

hamsterrrn
Avatar of mr76

ASKER

Thanks Barry
You must eat sleep and breathe this stuff.

yep, but i still dont know what im talking about ;-)