Display the active user using Terminal Services in Delphi
The active user is considered the user that has a session state of WTSActive

Not much of an article since I don't have time to write it, so here is the source code

NOTE (taken from MSDN): There might be a need to set some permissions. For more information, see Terminal Services Permissions. To modify permissions on a session, use the Terminal Services Configuration administrative tool.

Source Code