This repository has been archived by the owner on Aug 12, 2018. It is now read-only.
RelaunchElevated will always launch a process with a visible window #153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I stumbled upon an issue that drove me bit nuts over the weekend: if I called RelaunchElevated (by passing
/u
or manually), while launching from Visual Studio (with or without a debugger), the child process launched, but it didn't have any visible windows!Upon further investigation I found that the value of
STARTUPINFO.wShowWindow
was 0 for some reason, when running from VS (it corresponds to SW_HIDE). When launched from a cmd shell it had a value 1.Having no idea why this happens, I asked this question on StackOverflow https://stackoverflow.com/questions/36953886/startupinfo-wshowwindow-is-0-when-running-from-visual-studio
In the meantime, here's a fix that will pass
SW_SHOWNORMAL
to the child process, making sure its window is always visible.