If you’re application is running in a remote session (Terminal Services or RDP) and you need to get the name of the remote client you can use the attached class to call WTSQuerySessionInformation to get the information.
A couple of caveats, this code dynamically loads WTS32API.DLL which contains WTSQuerySessionInformation. This API wasn’t introduced until Windows Vista and Windows Server 2008.
The class uses @julesVerne LoadLib class to dynamically load the DLL. If you do not have access to that class then you will need to re-work the LoadLibrary calls. Alternatively, if you know your application will always run on newer operating systems and you can replace the dynamic loading with traditional statically linked API calls.
Seconds, this class uses my String Class. You can find that on ClarionMag or replace calls with StringTheory.
UP_System_TS.inc (2.3 KB) UP_System_TS.clw (4.2 KB)
With permission from Larry, you can download LoadLib from here.