mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 18:43:54 -06:00
Pass foreground rights to the emperor (#18325)
Forgetti di spaghetti in #18215. Closes #18324 ## Validation Steps Performed * Launch through the start menu * Explicitly minimize * Then... * Launch through the start menu again ✅ * Launch via wtd.exe in Win+R ✅ * Launch via wtd.exe in another Terminal ✅ * Launch via handoff ✅
This commit is contained in:
parent
19460f98e0
commit
50060452ea
@ -170,6 +170,14 @@ static wil::unique_mutex acquireMutexOrAttemptHandoff(const wchar_t* className,
|
||||
.cbData = gsl::narrow<DWORD>(payload.size()),
|
||||
.lpData = payload.data(),
|
||||
};
|
||||
|
||||
// Allow the existing instance to gain foreground rights.
|
||||
DWORD processId = 0;
|
||||
if (GetWindowThreadProcessId(hwnd, &processId) && processId)
|
||||
{
|
||||
AllowSetForegroundWindow(processId);
|
||||
}
|
||||
|
||||
if (SendMessageTimeoutW(hwnd, WM_COPYDATA, 0, reinterpret_cast<LPARAM>(&cds), SMTO_ABORTIFHUNG | SMTO_ERRORONEXIT, 5000, nullptr))
|
||||
{
|
||||
return {};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user