Search code examples
inno-setuppascalscript

GetComputerNameString Inno Setup


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?


Solution

  • 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 );