How to capture the logon and logoff events in Windows Vista?
-
Hi!! to all, I have sucessfully created a service which runs on Windows Vista and calls my application (without UAC dialogbox to apper) when first user logged in. Now I m stucking at a point as, I logoff or switch user after login (ie my service is running and my application is already invoked in the first users session), the application is not launched ie executed in the new logged on users account. I have used handlerEx function to capture the on session change event but I m unable to capture the login, logoff events. My service is running on the LocalSystem Account and my service type is SERVICE_WIN32_OWN_PROCESS. Please give me suggession to overcome this difficulty. With regards, Vaibhav Deshpande.
-
Hi!! to all, I have sucessfully created a service which runs on Windows Vista and calls my application (without UAC dialogbox to apper) when first user logged in. Now I m stucking at a point as, I logoff or switch user after login (ie my service is running and my application is already invoked in the first users session), the application is not launched ie executed in the new logged on users account. I have used handlerEx function to capture the on session change event but I m unable to capture the login, logoff events. My service is running on the LocalSystem Account and my service type is SERVICE_WIN32_OWN_PROCESS. Please give me suggession to overcome this difficulty. With regards, Vaibhav Deshpande.
Vaibhav Deshpande wrote:
I have used handlerEx function to capture the on session change event but I m unable to capture the login, logoff events.
What if, after you call RegisterServiceCtrlHandlerEx() to set your HandlerEx() function, you call SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct? Do you get the notifications then? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Vaibhav Deshpande wrote:
I have used handlerEx function to capture the on session change event but I m unable to capture the login, logoff events.
What if, after you call RegisterServiceCtrlHandlerEx() to set your HandlerEx() function, you call SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct? Do you get the notifications then? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thank you Sir!!!! Its working. Now I can capture the login, logoff, console connect,disconnect events. Using SERVICE_ACCEPT_SESSIONCHANGE I am able to capture the events in the HandlerEx function. Thanks again. With regards, Vaibhav Deshpande.
-
Thank you Sir!!!! Its working. Now I can capture the login, logoff, console connect,disconnect events. Using SERVICE_ACCEPT_SESSIONCHANGE I am able to capture the events in the HandlerEx function. Thanks again. With regards, Vaibhav Deshpande.
Vaibhav Deshpande wrote:
Thank you Sir!!!!
You're welcome! And you can call me Mark ;P
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Vaibhav Deshpande wrote:
Thank you Sir!!!!
You're welcome! And you can call me Mark ;P
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
:doh: ;P
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
:doh: ;P
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Sorry, was watching the first Star Wars last weekend, and your comment was straight out of the movie Judy
:-D
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Vaibhav Deshpande wrote:
I have used handlerEx function to capture the on session change event but I m unable to capture the login, logoff events.
What if, after you call RegisterServiceCtrlHandlerEx() to set your HandlerEx() function, you call SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct? Do you get the notifications then? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hi, I am trying to develop Win logOn Notification for Vista. My RegisterServiceCtrlHandlerEx() successfully set my HandelrEx() function however I am not able to receive Lock, Logon and logoff events. Moreover as suggested I am also calling SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct. The only notification I am getting at the moment in my HandlerEx() fuction is SERVICE_STOPPED. I am using C# for development. Please help me.
-
Hi, I am trying to develop Win logOn Notification for Vista. My RegisterServiceCtrlHandlerEx() successfully set my HandelrEx() function however I am not able to receive Lock, Logon and logoff events. Moreover as suggested I am also calling SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct. The only notification I am getting at the moment in my HandlerEx() fuction is SERVICE_STOPPED. I am using C# for development. Please help me.
If you're using C#, then using the .NET service classes should be easier... Override ServiceBase.OnSessionChange(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
If you're using C#, then using the .NET service classes should be easier... Override ServiceBase.OnSessionChange(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thanks Mark :) It works like a charm. Thanks again.
-
If you're using C#, then using the .NET service classes should be easier... Override ServiceBase.OnSessionChange(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Hi, I'm also encountering this problem. However, I'm using C++ ... Any idea? Thanks in advance, Moshe.
-
Hi, I'm also encountering this problem. However, I'm using C++ ... Any idea? Thanks in advance, Moshe.
-
Hi, I'm also encountering this problem. However, I'm using C++ ... Any idea? Thanks in advance, Moshe.
"I am trying to develop Win logOn Notification for Vista. My RegisterServiceCtrlHandlerEx() successfully set my HandelrEx() function however I am not able to receive Lock, Logon and logoff events. Moreover as suggested I am also calling SetServiceStatus() with SERVICE_ACCEPT_SESSIONCHANGE in the dwControlsAccepted field of the SEVICE_STATUS struct. The only notification I am getting at the moment in my HandlerEx() fuction is SERVICE_STOPPED." I am using C++ with a generated code using VS2005 of Win32Service, so I call RegisterServiceCtrlHandlerEx() and SetServiceStatus() from within OnStart(). Thanks in advance for your help, Moshe