Detect screen lock in Node WebKit

烂漫一生 提交于 2019-12-12 18:26:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!