No. ShellExecute
cannot run a program in another session. You'll need to use CreateProcessAsUser
. There are numerous questions on here that discuss how to do this.
Can ShellExecute run in active session?
-
04-12-2021 - |
Question
I have a command that i need run by cmd.exe when something happens in my program. Let's say the command is "calc.exe". When i use ShellExecute:
HWND win = GetActiveWindow();
ShellExecute(win,L"open",L"calc.exe",L"",L"", SW_SHOWNORMAL );
The calc.exe process starts in session 0 so i cannot see it. Is there any way to set it to start in the active users window? I don't want to use CreateProcess as I have been having privilege issues with it
Thanks
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow