Yes, reading the number of processes running as user X is another possible approach. Unfortunately I don't know how to read the user a process runs as, even less when TS is involved.
It is easy to count the instances running in the current session. Example in .Net:
Code:
private static int CountApplicationInstances()
{
var currentProcess = Process.GetCurrentProcess();
var processes = Process.GetProcessesByName(currentProcess.ProcessName);
// test if there's another process running in current session.
var intTotalRunningInCurrentSession = processes.Count(prc => prc.SessionId == currentProcess.SessionId);
return intTotalRunningInCurrentSession;
}
(based on
https://stackoverflow.com/a/36210660/80901)