检测Node WebKit中的屏幕锁定 [英] Detect screen lock in Node WebKit

查看:135
本文介绍了检测Node WebKit中的屏幕锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用节点WebKit开发适用于Windows的应用程序,并希望在用户锁定屏幕时执行一些任务,例如停止一些计时器.是否可以在节点WebKit中使用.我研究了屏幕的几何形状,但它似乎仅提供检测屏幕的数量,主要用于多屏幕应用程序.

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.

谢谢

推荐答案

使用API​​ 函数 OpenInputDesktop user32.dll.可以通过 node-ffi 模块进行呼叫:

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' ]
   ]
});

这篇关于检测Node WebKit中的屏幕锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆