-1

In C#, how to check programatically if the current user is in Windows 'Disconnected' state?

Background: On a server, I would like all instances of my program to selv-terminate if the current user is disconnected.

The program is not running in elevated state, i.e. not as administrator.

1 Answers1

1

You will have to override WndProc to hook into the Windows System Messages. This will not be possible if you're in a console app.

see: Detect Active RDP sessions

Victor Procure
  • 886
  • 1
  • 6
  • 17