So i have some tasks that i need to be notified when the user locks their machine. This is in order to pause those tasks. Equally i need to know when the machine has been successfully unlocked in order to resume said tasks. This is purely for a Windows only function so doesn't need to be cross-platform.
Ive looked through the Electron docs and found this about the powerMonitor API's however it only has events for suspend and resume. I assume they refer to the machine going to sleep as locking and un-locking does not trigger them on my machine (Win 10).
I know very little of how core Windows works, with its messages/event system. However i have found this which lists information about the WM_WTSSESSION_CHANGE which seems to be what i need. Notably the WTS_SESSION_LOCK (0x7) and WTS_SESSION_UNLOCK (0x8) status codes.
However i can't find a way either with electron or NodeJS directly to listen to Windows messages.
Any advice on the problem would be greatly appreciated. Thanks
via ste2425
No comments:
Post a Comment