开发者

Detect user log on from a Windows Service

Is there for my .Net application to detect if a user has logged on? It is a Windows Service, so it will be running before logon.

What I want to do is display a 开发者_高级运维"popup" when a user logs on to tell them the status of the application


I think you can modify the service to allow "Service can interact with desktop" (from services control panel) then create a NotifyIcon in your service which can popup messages on specific events. Though I'm not positive if this is possible, I would google "Windows Service" coupled with "NotifyIcon".

Addendum

Take a look at this SO article on desktop notifications. They go over the cautions of doing so, and way of making this happen (which basically eludes to building a separate application that establishes a perpetual connection that can receive updates from the service and notify accordingly).


Take a look at ServiceBase.OnSessionChange.

Remember to set CanHandleSessionChangeEvent to true at the constructor. Otherwise, this won't take effect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜