GithubHelp home page GithubHelp logo

node-windows-window-controller's Introduction

windows-window-controller

Wrap user32.ShowWindow() by node via node-ffi

Version License Available platform Build status Coverage Status

What can I do with this?

Hide, show, maximize, minimize a window where you know either the app process PID, or window's hWnd, or keyword title of the window(s).

Installing

# as global cmd-line
npm install --g windows-window-controller

# as module
npm install --save windows-window-controller

Usage

# ------ as global cmd-line ------

# by pid. 0x7632===30258
hide-window --pid=0x7632
hide-window --pid=30258
# by keyword of title case sensitive
hide-window --title=vim

# 3: Activates the window and displays it as a maximized window.
show-window --pid=0x7632 --status=3
show-window --pid=30258 --status=3
show-window --title=vim --status=3

# 1: Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
nwwc --hwnd=0x702C6 --status=1


# ------ as module ------
const nwwc = require("windows-window-controller");

nwwc.hide(0x7632).then((execRet) => console.log(execRet));
nwwc.hide(30258).then((execRet) => console.log(execRet));
nwwc.hide('vim').then((execRet) => console.log(execRet));

# 2: Activates the window and displays it as a minimized window.
nwwc.show(0x7632, 2).then((execRet) => console.log(execRet));
nwwc.show(30258, 2).then((execRet) => console.log(execRet));
nwwc.show('vim', 2).then((execRet) => console.log(execRet));

# hide all windows relative to the main process, such as the window of child process
nwwc.hide(0x7632, false).then((execRet) => console.log(execRet));

Dependencies Troubleshooting

Relevant

Known bugs:

  • The result of find hWnds by pid is empty when build by VS2017. It works when VS2013 and VS2015.

License

MIT

node-windows-window-controller's People

Contributors

waitingsong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rmd13 nodgear

node-windows-window-controller's Issues

Uncaught Error: task.matchType value invalid

I am sorry to post this here, but i don't know better place to ask.

I got this code and I can't make it to work.

`

<title> Test </title> <script src="/node_modules/jquery/dist/jquery.min.js"></script> Hello
<script type="text/javascript"> const tasklist = require('tasklist'); const nwwc = require("windows-window-controller"); tasklist({verbose: true}).then(tasks => { console.log(tasks); var table = document.getElementById("test"); for (var i = 0; i < tasks.length; i++) { if (tasks[i].windowTitle !== "N/A"){ var row = table.insertRow(); var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); var cell3 = row.insertCell(2); var cell4 = row.insertCell(3); cell1.innerHTML = tasks[i].imageName; cell2.innerHTML = tasks[i].pid; cell2.setAttribute("id", tasks[i].pid); cell3.innerHTML = tasks[i].memUsage; cell4.innerHTML = tasks[i].windowTitle; cell4.setAttribute("id", tasks[i].windowTitle); } } }) $(document).ready(function() { $("#test").on("click", "td", function() { console.log(event.target.id); // let temp_pid = Number(event.target.id); let temp_pid = event.target.id; console.log(typeof(temp_pid)); nwwc.hide(temp_pid).then((execRet) => console.log(execRet)); // nwwc.hide(event.target.id).then((execRet) => console.log(execRet)); // nwwc.hide(event.target.id).then((execRet) => console.log(execRet)); }); }); </script> `

I always get this error if it's pid "Number" and also if is string "windowTitle".

When I tried to edit user32.js i received empty object and window did not minimized.
Can you point me to what is wrong.

I want to make an app to control opened windows, something like windows taskbar in windows using nwjs -v 0.15.4 64bit and I am on Windows 10

Error in use library

Hi
I pkg my project with "pkg library" and try to use this library but there are errors
Please help to me for solve it
Thanks

Error: The module '\?\C:\wamp64\www\Patriot\robot\node_modules\ref\build\Release\binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (module.js:680:18)
at Module.load (module.js:564:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:595:17)
at Module.require (pkg/prelude/bootstrap.js:1225:31)
at require (internal/module.js:11:18)
at bindings (C:\snapshot\robot\node_modules\bindings\bindings.js:112:48)
at Object. (C:\snapshot\robot\node_modules\ref\lib\ref.js:5:47)
at Module._compile (pkg/prelude/bootstrap.js:1320:22)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.