I’ve been having some difficulty with my inno pascal script. I familiarized myself a bit (just a bit)
with Pascal, but its becoming more clear to me now that pascal script may be very different.
The following code compiles fine with freepascal:
program test;
uses windows;
function GetPCName: string;
var
buffer: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
Size: Cardinal;
begin
Size := MAX_COMPUTERNAME_LENGTH + 1;
Windows.GetComputerName(@buffer, Size);
Result := StrPas(buffer);
end;
begin
writeln('ComputerName: ' + (GetPCName));
readln;
end.
How can I do something like this in my inno [code] section?
I tried the above, but it doesn’t seem to like “uses windows;”
First off, you can use the builtin
GetComputerNameStringsupport function.You can declare a function in the code section to be able to call library functions. Something like the below should work:
See ‘codedll.iss’ in the examples folder of inno setup.