Roger Lipscombe
Roger Lipscombe

Reputation: 91825

How do I enumerate open windows in a different session from a service?

I've seen this question, but I was hoping to avoid using CreateProcessAsUser. I can enumerate windows by calling EnumDesktopWindows, and I can get the desktops by calling EnumDesktops. Unfortunately, EnumDesktops requires a window station name, and WTSQuerySessionInformation with WTSWinStationName explicitly does not return the window station name.

So, I guess my question is: how do I get hold of the Window Station for a WTS session?

Upvotes: 0

Views: 1615

Answers (1)

Brian R. Bondy
Brian R. Bondy

Reputation: 347206

You can use EnumWindowStations. For more background please see this blog post I wrote on Sessions, Window Stations, and Desktops.

Upvotes: 2

Related Questions