I’m writing a python script which updates the MySql database in diffrent process. In that i want to update the database field (“Status”) when the user locks his system (as “Locked”) or Just before shutdown\Log off process to (“Offline”). I’m not able to find out how to trigger the definition when the system state changes.
I’m writing a python script which updates the MySql database in diffrent process. In
Share
You have to monitor the
WM_WTSSESSION_CHANGEmessage forWTS_SESSION_LOGOFFandWTS_SESSION_LOCK.Details for how to do this in Python can be found at Detect windows logout in Python
(This answer is hard to find if you don’t already know the answer.)