Reputation: 1
I have a Win32 console app which can launch another console app using ShellExecuteEx. The intention is for the launched app to inherit the parent's console, otherwise the observed behavior is a pop-up console windows that disappears immediately once the child process finishes, such that the user won't be able to see any messages output by the child process.
The code goes something like this:
SHELLEXECUTEINFO shExecInfo = { 0 };
shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
shExecInfo.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NO_CONSOLE | SEE_MASK_NOASYNC;
shExecInfo.hwnd = global_window;
shExecInfo.lpVerb = L"open";
shExecInfo.lpFile = exePath.c_str();
shExecInfo.lpParameters = args.c_str();
shExecInfo.nShow = SW_SHOWNORMAL;
if (!ShellExecuteEx(&shExecInfo)) {
...
}
exePath
is something like "shell:appsFolder\\MyApp_publisherIdHash!MyApp"
. It's installed via an MSIX package.
I've observed that, on Windows 11, this works as intended, while on Windows 10, a new console pops up, ignoring the SEE_MASK_NO_CONSOLE
flag.
I strived to find any documentation or other example of someone experiencing that behavior, but was unable to find any hint. Does anyone by any chance knows what is the reason for this behavior difference? Could it be related to the use of shell:appsFolder
(which could internally make it a DDE transaction)? Is there any portable to way to make it work on any flavor of Windows?
Many thanks.
Upvotes: 0
Views: 138