I have very similar problem to this one : SetForegroundWindow in Remote Desktop Connection Everything works when I am connected and watching the RDC, but when I'm not.. Nothing happens. I am using python and pywinauto, trying to use SendKeys method : SetForegroundWindow returns 0, the same as GetLastError after that, so I have no idea what might cause the trouble.
Edit: I also tried other methods like BringWindowToTop, or SetActiveWindow, also I tried to sent alt key before changing windows - nothing worked.