If the user pressed the shortcut, it is hap.exe which received the last input event, so SetForegroundWindow() should work according to Microsoft. If SetForegroundWindow() fails, we just use ForceForeground(). I don't remember exactly when, I have seen ForceForeground() fails but SetForegroundWindow() succeeds.
If the user pressed the shortcut, it is
hap.exe
which received the last input event, soSetForegroundWindow()
should work according to Microsoft. IfSetForegroundWindow()
fails, we just useForceForeground()
. I don't remember exactly when, I have seenForceForeground()
fails butSetForegroundWindow()
succeeds.