问题
I'm developing an application for Windows using node WebKit and want to perform some tasks when the user locks the screen like stopping some timers. Is it possible in node WebKit. I looked into screen geometry but it seems to offer only detecting number of screens mainly for multi screen apps.
Thanks
回答1:
Use the API function OpenInputDesktop from the library user32.dll
. The call can be made through the node-ffi module:
var FFI = require('node-ffi');
// user32.dll
var user32 = new FFI.Library('user32', {
'OpenInputDesktop': [
'IntPtr', [ 'int32', 'bool', 'int32' ]
]
});
来源:https://stackoverflow.com/questions/34446237/detect-screen-lock-in-node-webkit