How to determine if a window can be displayed?

When an application runs as a Windows service (written in .NET), what would be the best way to determine if a user is logged in and when a user logs in to start displaying the necessary dialogs or when that user logs out so that you can disconnect display dialogs?

I hope I formulated it correctly :)

+2
source share
2 answers

You should not do this at all from the service. First, the default service does not have access to the desktop. You can change this in versions of Windows before Vista by checking the box "Allow the service to interact with the desktop" in the service properties dialog box, but this is a very, very bad idea.

In Vista, services cannot interact with the desktop at all.

You make the assumption that at that moment there will be only one interactive user on the machine, which is not always the case. Due to Terminal Services, you can have more than one user logged into interactive sessions.

, . (, Remoting WCF, ). , , .

+4

- , , . - , , , . , , .

0

All Articles