first of all I want to tell you that I've searched a lot, and this is not Duplicate question.开发者_Python百科 My problem is that I want to capture windows events (SystemEvents) when triggered but from windows service application. I've followed this example http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.aspx. It says that services need to have message loop (MessagePump in the above example) to process all of these events (Login, logout, power events etc.). The problem is that this example is working great under Windows XP, but for Windows 7 none of these events is caught. Does anyone have solution to this problem ? I read somewhere that I need to use SENS (System event notification services). Can you point me into the right direction? Thanks.
I've found the solution myself. SENS is unusable under Windows 7. WTS Api is the key. If someone is interested i can post the solution. Thanks anyway :).
精彩评论