There are 2 things that you should look at:
1st (thanks to TLama that spotted this issue)
The Key
string - there is redundant HKEY_LOCAL_MACHINE\
in string Value
.
You call HKLM
branch in RegQueryDWordValue(HKLM, key, 'Install', install);
The correct Key
should be:
key := 'SOFTWARE\Microsoft\ReportViewer\' + version;
2nd
You can call the silent install of ReportViewer if you know parameters for command line.
As you know that you shold use /q:a /c:"install.exe /q"
, you just simply add it in ShellExec
function:
ShellExec('', ExpandConstant('{tmp}\ReportViewer.exe'), '/q:a /c:"install.exe /q"', ExpandConstant('{tmp}'), SW_HIDE, ewWaitUntilTerminated, ErrorCode)