During development, you may encounter a lock or unlock event for obtaining the computer.ProgramWhat to do and what the program will do after unlocking. For example, after locking the unlocked 3D device component, the lost becomes invalid and needs to be retrieved again. Otherwise, the 3D device will not be refreshed.
So what should we do?
Registersessionnotification and unregistersessionnotification can be used for registration and anti-registration. To obtain notification events, wm_wtssession_change messages will be sent to the registration window when an event exists. The corresponding wparam parameter can be parsed as follows:
// Wparam values:
Wts_lele_connect = 1;
Wts_lele_disconnect = 2;
Wts_remote_connect = 3;
Wts_remote_disconnect = 4;
Wts_session_logon = 5;
Wts_session_logoff = 6;
Wts_session_lock = 7;
Wts_session_unlock = 8;
Wts_session_remote_control = 9;
In addition to the above methods, you can use a global hook to intercept lockworkstation in user32.dll to obtain it. Or rewrite the DLL corresponding to Winlogon. However, it is still simple and secure.
For the following two methods, see:
Http://topic.csdn.net/u/20070516/09/132db03e-d0d8-4a92-9862-8a1e1e41b224.html