I have a system service that starts another application. This application (written in C#) at some point needs to get all the opened windows (applications) and list their names.
I used EnumWindow (from Win32), i used Process.GetProcesses() and process.MainWindowTitle (from C#) all i get is this:
Process: UI0Detect
Window title: Interactive Services Detection
If I run that application by hand it gives me all the windows as it should. But when the system service runs the app all i get is this one service.
How can i make the app get me the correct list of active windows?
Thank you
Windows services do not run in the same “session” as a normal program, so the 2nd started program also starts in the special session when your service launches it. You will need to use CreateProcessAsUser and create your second app in the user session you want to monitor.
See this MSDN article on writing interactive services for more information.