How to know programatically that Windows has logged in/Logged Off/Shut Down occured etc?
-
Hello Friends In my dialoged based MFC programm I need to handle and set certain registry values before windows gets shut down and also immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords). I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this? Any such example or any idea please. Thankx and regards in advance. Mahesh
-
Hello Friends In my dialoged based MFC programm I need to handle and set certain registry values before windows gets shut down and also immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords). I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this? Any such example or any idea please. Thankx and regards in advance. Mahesh
Amarelia wrote:
but don't know how to trap that message or how to achieve this?
For the logoff: There is a MFC OnQueryEndSession() wrapper in the class CWnd. Since your Dialog is derived from CWnd, you can do following (assuming VC6++) : Rightclick on your Cdialog class in the class browser : Add Windows Message Handler, In the dialog that pops up change Dialog to Window in the combobox on the bottom right, and then select WM_QUERYENDSESSION in the list. Here you have your wrapper. This implies that your app is alive when windows shutdown. ~RaGE();
-
Hello Friends In my dialoged based MFC programm I need to handle and set certain registry values before windows gets shut down and also immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords). I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this? Any such example or any idea please. Thankx and regards in advance. Mahesh
Amarelia wrote:
I need to handle and set certain registry values...immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords).
You can do this with your own GINA DLL, or implement the
ISensLogon
interface.Amarelia wrote:
I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this?
I believe you'll want to look for
WM_ENDSESSION
instead. Windows will send theWM_QUERYENDSESSION
message asking applications if it is ok to exit. If any of them respond with a zero value, no furtherWM_QUERYENDSESSION
messages are sent. If all of the applications respond with a non-zero value, Windows will then send aWM_ENDSESSION
message.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
-
Amarelia wrote:
I need to handle and set certain registry values...immediately after Windows loggs in(i.e immediately after user presses Ctrl+Alt+Del and enterys passwords).
You can do this with your own GINA DLL, or implement the
ISensLogon
interface.Amarelia wrote:
I read that it sends some message WM_QUERYENDSESSION or something like that but don't know how to trap that message or how to achieve this?
I believe you'll want to look for
WM_ENDSESSION
instead. Windows will send theWM_QUERYENDSESSION
message asking applications if it is ok to exit. If any of them respond with a zero value, no furtherWM_QUERYENDSESSION
messages are sent. If all of the applications respond with a non-zero value, Windows will then send aWM_ENDSESSION
message.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista. --------------- Windows Login Winlogin (GINA) is being rewritten for Windows Vista to reduce number of necessary processes and components loaded. The new GINA will not be replaceable. A new Credential Provider Model will be used for extensibility. New mechanisms will also be provided to support existing functionality. A new Eventing and Stacking, and Chaining model will be provided. http://www.activewin.com/winvista/thestateofvista.shtml[^] 8bc7c0ec02c0e404c0cc0680f7018827ebee
-
I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista. --------------- Windows Login Winlogin (GINA) is being rewritten for Windows Vista to reduce number of necessary processes and components loaded. The new GINA will not be replaceable. A new Credential Provider Model will be used for extensibility. New mechanisms will also be provided to support existing functionality. A new Eventing and Stacking, and Chaining model will be provided. http://www.activewin.com/winvista/thestateofvista.shtml[^] 8bc7c0ec02c0e404c0cc0680f7018827ebee
Toby Opferman wrote:
I wouldn't write a GINA unless nessecary since it will not be portable to Windows Vista.
I wouldn't either. I was just offering suggestions. Care to offer help on this one?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb