سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top