I have a test that launches an app and verifies it has launched through calls to GetForegroundWindow(). The test is run on a remote machine that we usually access through remote desktop. When we have a rdp session open to the machine, the test completes and all is well. However, once we close the remote desktop, the test fails because GetForegroundWindow is always returning Null. I've checked that the active desktop after I disconnect is still 'Default', so I'm sure I am not running into this issue. Any ideas what might be causing this?
Thanks in advance
If your remote desktop is a virtual machine you can use the tscon command:
tscon 1 /dest:console where "1" is the ID of active session.
This command disconnect the RDP but send the session to the console. You can catch windows, take screenshot, etc...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With