954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pascal / Inno Question re: Cardinal

Not sure if this is the correct forum. I am using Inno and within the scripting portion I cannot figure out how to convert a cardinal value into a string so it can be displayed in a MsgBox() so I can verify the value.
When I convert the cardinal using something like b := IntToStr(a) then MsgBox(b) it displays a huge number (decimal representation)??

Essentially I am trying to use the GetFileVersion() function in in Inno to get the file version of a DLL and then dislpay the version in a MsgBox(). I havent been able to figure out how to convert the cardinal into a string properly

thanks.

Rockpile
Newbie Poster
18 posts since Jul 2009
Reputation Points: 23
Solved Threads: 0
 

Ok maybe more information, I am attempting to get the version info od msi.dll. When i rt clk > view the properties of the file the version info says it is version 5.0xx.. but when I run the IntToStr() function on the cardinal it returns a number like 32456000 ???

Rockpile
Newbie Poster
18 posts since Jul 2009
Reputation Points: 23
Solved Threads: 0
 
pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 874
 

That link helped, thank you. I needed to break out the upper and lower bits of the cardinals to get the proper version numbers using 'shr 16' and 'and $FFFF'

function GetVersionNumbers(const Filename: String; var VersionMS, VersionLS: Cardinal): Boolean;

I ended up using something close to the following...

myfile : string;
MS, LS : cardinal;
V1, V2, V3 V4 : dword;

begin
myfile := 'c:\windows\system32\msi.dll'

GetVersionNumbers(myfile, MS, LS);

V1 := MS shr 16;
V2 := MS and $FFFF;
V3 := LS shr 16;
V4 := LS and $FFFF;

MsgBox(IntToStr(V1)+'.'+IntToStr(V2)+'.'+IntToStr(V3)+'.'+IntToStr(V4), mbInformation, MB_OK);

end;
Rockpile
Newbie Poster
18 posts since Jul 2009
Reputation Points: 23
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You