0

I have a line of text in my Inno Setup file that is:

  • TextBox.Text := GetComputerNameString();

to get the computers name. I'm getting this error when trying to go through the setup wizard once it's built:

enter image description here

Do I have to do some sort of code setup (like registering an external function or something) to call this function or should I just be able to call it since it's built in?

B-M
  • 1,231
  • 1
  • 19
  • 41
  • On which OS are you facing this problem? – Wosi Oct 16 '15 at 16:26
  • Windows Server 2008 R2 Standard, 64 bit. – B-M Oct 16 '15 at 16:29
  • What does `GetLastError` return after trying to retrieve the computer name? http://www.vincenzo.net/isxkb/index.php?title=GetLastError_%28%29 – Wosi Oct 16 '15 at 16:33
  • Unknown at the moment, I shall put that in and give it a look. – B-M Oct 16 '15 at 16:49
  • 1
    Are you sure the error is caused by the `GetComputerNameString`? Can you put `Log('Before GetComputerNameString');` before the `TextBox.Text := GetComputerNameString();` and `Log('After GetComputerNameString');` after and show us the installer log? – Martin Prikryl Oct 16 '15 at 20:04

1 Answers1

-1

You declare a variable as a global variable

[code]
var
    glbComputerName String;

...
step by 1 function
    glbComputerName := GetComputerNameString();
    TextBox.Text := glbComputerName;
...
step by 2 function
    //glbComputerName use...
    MsgBox( 'Computer Name :' + glbComputerName, mbError, MB_OK );