How to ensure process in running in console session lazarus / 34-Windows ---------------------------------------------------------------------- Robert Gilland · 2012-07-27 06:23 we have an windows XP embedded machine ( single session workstation ) This should only allow 1 session however when Using WTSGetActiveConsoleSessionId this returns a value of 2. How can this be? I am logging in via RDP starting a process. This process is returning my session = 2. So I then cancelling it. becasue this is a non console session id. Since the workstaion only takes 1 session. How to ensure that my task is running on the systems consolesession. Kind Regards, RObert. ---------------------------------------------------------------------- Robert Gilland · 2012-07-30 23:01 OK I have solved it. After searching everywhere and finding nothing. Step 1. Call kernel32.dll -> WTSGetActiveConsoleSessionId  to get console session id. Step 2. use jedi library function jwsclToken.JwGetProcessLogonSession to get process session id. Step 3. if( console session = process session ) or ( process session is zero )then VICTORY!!!! 2 days of in depth searching to get the result. ---------------------------------------------------------------------- BigChimp · 2012-07-31 06:17 Glad you solved it and that you documented the result here to save the next unfortunate soul with this problem 2 days of searching. Note: if you don't get any useful responses here, you can also try asking in the FPC mailing list (or Lazarus mailing list).