[Refactor]Use same improved BringToForeground across the solution (#28532)

* Use single BringToForeground across the solution

* Close flyout manually

* Try with sending input, if it fails try threads
This commit is contained in:
Stefan Markovic
2023-10-23 18:16:11 +02:00
committed by GitHub
parent f718bef45c
commit 6a092548b1
13 changed files with 95 additions and 109 deletions

View File

@@ -45,13 +45,5 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
{
}
}
public static void BecomeForegroundWindow(IntPtr hWnd)
{
NativeKeyboardHelper.INPUT input = new NativeKeyboardHelper.INPUT { type = NativeKeyboardHelper.INPUTTYPE.INPUT_MOUSE, data = { } };
NativeKeyboardHelper.INPUT[] inputs = new NativeKeyboardHelper.INPUT[] { input };
_ = NativeMethods.SendInput(1, inputs, NativeKeyboardHelper.INPUT.Size);
NativeMethods.SetForegroundWindow(hWnd);
}
}
}