1

I'm working on a C# app that launches a Remote Desktop connection on behalf of the user. I do that by programmatically running mstsc.exe with the required config to automatically launch the session.

I'd like to know if the connection succeeded or not to handle the potential errors. Is there an event or something like that to notify me that the remote session was successfully opened (or if the connection failed)?

For now I found a few leads:

  • This interface that seems to expose exactly what I want, but I don't see how to use it
  • Looking at the Event Viewer in Windows, I found some events that seem to be triggered when the host is unreachable, but I'd like to know if there is a simpler solution than looking for these events:
    • Event 1026: RDP ClientActiveX has been disconnected (Reason= 516)
    • Event 1105: The multi-transport connection has been disconnected.

Thanks for your help!

WSH
  • 331
  • 1
  • 2
  • 10
  • https://learn.microsoft.com/en-us/windows/win32/termserv/monitoring-session-connections-and-disconnections – Lex Li Jun 04 '20 at 16:47
  • This links seems to apply to server side monitoring, if I understand correctly. In my case I want to know on client side when mstsc.exe connects to a remote session. – WSH Jun 05 '20 at 10:00

0 Answers0