Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Windows service not able to capture Login/Lock/Unlock in Win7.
if any one knows the solution or any idea or approach, please help me out.
waiting for all of your positive response.

Thanks in Advance..
Posted
Comments
Sergey Alexandrovich Kryukov 13-Jun-11 5:27am    
How did you try to capture those events?
--SA
Sandeep Mewara 13-Jun-11 10:51am    
OP replied:
SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);System.Events void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) { //Console.WriteLine("lock"); logee.WriteEntry("Inside SystemEvents_SessionSwitch "); if (e.Reason == SessionSwitchReason.SessionLock) { isLockedTmp = true; } else if (e.Reason == SessionSwitchReason.SessionUnlock) { isLockedTmp = false; } } the following code is worked finely in winxp but not worked in WS on win7
Dheeraj_Gupta 14-Jun-11 0:57am    
thanks for time.
i have tried it by making log state and even by taking a increment variable to identify that the event is being hit.
Dheeraj_Gupta 13-Jun-11 5:52am    
SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);System.Events


void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
{

//Console.WriteLine("lock");
logee.WriteEntry("Inside SystemEvents_SessionSwitch ");
if (e.Reason == SessionSwitchReason.SessionLock)
{
isLockedTmp = true;
}
else if (e.Reason == SessionSwitchReason.SessionUnlock)
{
isLockedTmp = false;
}
}



the following code is worked finely in winxp but not worked in WS on win7
Sergey Alexandrovich Kryukov 13-Jun-11 12:07pm    
Sounds reasonable, at first glance. So what, never called? Are you sure? Did you use EventLog to log some points in this code to make sure?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900