Code: Select all
If TrayWindow.Enabled then
begin
if not ProcessActive('project1.exe') then // look to find process
NewProcess('c:\project1.exe');
end;
Is there a way to get a process listing for the current session of windows?
I have tried the follwing :
process('project1.exe').isvalid;
Looping through all Processes.ItemCount and checking them, and I have also looped through the TaskbarWindows. All of those methods seem to still see that the exe is running in the other session.
Oddly if I stop the sevice, log in as the second user, then start the service while on as the second user the program gets launched, but on the first users account, so when I switch back to the first user the program is running.
How do I get the app to lauch under the correct user, and scan through processes that are for the current user session?
Regards,
Jeff Lawton