winctl | Windows window manipulation for node.js
kandi X-RAY | winctl Summary
kandi X-RAY | winctl Summary
Windows window manipulation for node.js. winctl wraps a few functions of the windows api to allow iterating over currently opened windows and performing a few limited operations on them. This is not a production ready module! There is no real documentation either yet. Sorry for that. The example has to suffice for now.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of winctl
winctl Key Features
winctl Examples and Code Snippets
var winctl = require('../');
var win = winctl.GetActiveWindow();
// Output some information about the currently active window
console.log("Active Window Hwnd:", win.getHwnd());
console.log("Active Window Title:", win.getTitle());
console.log("Dimen
Community Discussions
Trending Discussions on winctl
QUESTION
I'm trying to detect when a user unlocks their workstation. The following code attempts to register the window to receive session change messages using WTSRegisterSessionNotification(). Supposedly after this I can listen for WM_WTSSESSION_CHANGE which can contain WTS_SESSION_UNLOCK as a param.
Issue: Currently WTSRegisterSessionNotification() always returns false.
Anyone know how I can achieve this? I'm on Windows 10 btw.
...ANSWER
Answered 2017-Apr-10 at 01:52You should not be using winctl.GetActiveWindow
to get a HWND because you don't actually know which window is active. As far as I can tell GetActiveWindow calls GetForegroundWindow
internally and that is insane for two reasons:
- GetForegroundWindow returns the foreground window on the users desktop and could be a window in another application.
- Windows has an actual function named GetActiveWindow and it is not the same as calling GetForegroundWindow.
Create a hidden native window somehow or use a window provided by electron (GetTopLevelNativeWindow
perhaps?)
GetLastError
returns the wrong value because you are calling it too late. There is a thick layer of stuff between you and the native Windows function and something is calling SetLastError
before you regain control. The 'ffi' library needs a way to specify that you want it to call GetLastError on your behalf immediately after calling the requested function.
And finally, a Windows BOOL
is int sized and I'm guessing node.js treats it as a byte?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install winctl
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page