Michele
Michele

Reputation: 3871

'string': invalid statement in installScript ...can't declare string

I'm trying to get info on errors that may be happening when I LaunchApplication in installScript, but get an error when I do exactly what this example shows: store error code from custom action

export prototype CmdExecute(HWND);

function CmdExecute(hMSI)
begin 
    LAAW_SHELLEXECUTEVERB = "runas";
    String returnCodeStr;
end;

When I build, I get, ErrorCode C8025, String: undefined identifier. When I type string, it suggests the word STRING. I've tried STRING and String like the example shows but it's always unidentified. How do I get the installScript to let me define strings?

I want to do what the example at the link shows.

Thanks for any help! I am using InstallShield 2021.

Upvotes: 0

Views: 51

Answers (1)

Michele
Michele

Reputation: 3871

I figured it out. The string declaration was in the wrong place. The String and other type/variable declarations go above begin.

function CmdExecute(hMSI)
STRING returnCodeStr;
NUMBER nvSize,returnCode;
begin 
    nvSize=250;
    LAAW_SHELLEXECUTEVERB = "runas";
    returnCode=LaunchApplication("C:/Windows/Microsoft.NET/Framework/v4.0.30319/RegAsm.exe",
"pathTo/failename.dll /codebase", "",
SW_NORMAL, WAIT, LAAW_OPTION_WAIT_INCL_CHILD);
     if( returnCode <ISERR_SUCCESS ) then
         MessageBox ("CmdExecute call failed!", SEVERE);
     endif;
     NumToStr(returnCodeStr,returnCode);
     SprintfMsiLog("returnCode="+returnCodeStr);
end;

Upvotes: 0

Related Questions