Code was working normally, but after upgrading to inno 6.0.2, i got an error when compile. Error:
Type mismatch
in line if LoadStringFromFile(TmpFile, ExecStdout) then
code as below:
function NextButtonClick(CurPageID: Integer): Boolean;
var
TmpFile, ExecStdout: string;
ResultCode: integer;
begin
Result := True;
if CurPageID = HostingPage.ID then
begin
Domain := HostingPage.values[0];
DomainPort := HostingPage.values[1];
TmpFile := ExpandConstant('{tmp}') + '\~pid.txt';
Exec('cmd.exe',
'/C FOR /F "usebackq tokens=5 delims= " %i IN (`netstat -ano ^|find "0.0:'+DomainPort+'"`) DO '
+ '@tasklist /fi "pid eq %i" | find "%i" > "' + TmpFile + '"', '', SW_HIDE,
ewWaitUntilTerminated, ResultCode);
if LoadStringFromFile(TmpFile, ExecStdout) then
begin
MsgBox('The Port ('+DomainPort+') ' #13 + ExecStdout, mbError, MB_OK);
Result := False;
end;
DeleteFile(TmpFile);
end;
end;