Acrobat does not start when open a pdf file from our program
Our program needs to be launched with administrator privileges. However, after starting with administrator privileges, there is a problem with the function to open PDFs from our program.
The issue occurs as follows:
If the default app for PDF file is Acrobat, two Acrobat background processes appear in the Task Manager, but the PDF file is not opened.
This issue also occurs when Acrobat is used independently. It can be reproduced using the following steps:
- Right-click on the Acrobat menu and select "Run as administrator" to launch Acrobat, and
- Open a PDF file while Acrobat is already running.
The issue can be easily replicated with the following sample source code. (As shown in the attached image,
it is necessary to set the project's "UAC Execution Level" to "requireAdministrator (/level='requireAdministrator')".)
LPCWSTR filePath = L"test.pdf";
HINSTANCE result = ShellExecute(NULL, L"open", filePath, NULL, NULL, SW_SHOWNORMAL);