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.

Recommended Answers

All 3 Replies

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 ???

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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.