How do you open PDFs from an Inno Setup installer on Windows 10? I'm trying to display help documents, and the technique that I use (based on comments on this question) and that works for Windows 7 results in nothing happening when running on Windows 10 (file doesn't open, and no error message is reported).
Specifically, when trying to open a PDF (either before installation in a custom code section using ShellExec()
or after installation in the [Run]
section using the shellexec
flag) in a installer that requires elevated privileges, it will spawn 2 Adobe processes, but no windows will open (and furthermore, no other PDFs can be opened until those processes are manually killed). However, the PDF will open if:
- Another PDF is already open,
- The installer was launched from an already-elevated command prompt, or
- The installer was lanuched from Inno Setup Studio
In all other situations, the PDF will not launch (and until you kill the 2 Adobe processes, no other PDF will open).
This is essentially the code that works on Windows 7 but not Windows 10:
ExtractTemporaryFile('test.pdf');
ShellExec('open',
AddQuotes(ExpandConstant('{tmp}\test.pdf')), '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
''
instead of open? (This would also explain whyShellExecAsOriginalUser
works whenShellExec
does not - the non-admin has the open verb action assigned for PDF files.) The default for newer Acrobat Reader versions is Read, not Open, and using an empty string will cause it to use the default action. – Ken White''
toShellExec
has the same result. However, that's good to know that read is the new default action, thanks. – dbc