I have a C# console application (A) that opens with the black windows console. Sometimes at startup it steals the focus from another program (B) that needs the focus.
Question: How can I give focus back from A.exe
to B.exe
?
A -> Focus -> B
Details:
- Program B is not mine and I can't do anything about it. It has a GUI, multiple windows and 1 of them needs the focus (it might be a modal dialog window).
- Program A doesn't need any focus and it doesn't interact in any way with program B.
- Program A starts via Startup shortcut and runs basically in background (it is released but still in development though, that's why console window)
- I have a few moments/up to minutes to check and give the focus back.