Harshad Ranganathan
Harshad Ranganathan

Reputation: 1828

Detect screen lock in Node 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.

Thanks

Upvotes: 2

Views: 1382

Answers (1)

stdob--
stdob--

Reputation: 29172

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

Upvotes: 2

Related Questions