Call ShowWindow from node via ffi-napi
npm install windows-api-show-windowprocess.pid as the PID.
powershell
npm install --save windows-api-show-window
`
Testing (manual only)
`powershell
// run with win + r
node {repository-location}/test/index.js
`
Usage
`js
var api = require("windows-api-show-window");
api.hideCurrentProcessWindow().then(() => {
// console window is hidden
}).catch(err => {
console.error(err);
});
api.showCurrentProcessWindow().then(() => {
// console window is visible
}).catch(err => {
console.error(err);
});
api.maximizeCurrentProcessWindow().then(() => {
// console window is maximized
}).catch(err => {
console.error(err);
});
api.minimizeCurrentProcessWindow().then(() => {
// console window is minimized
}).catch(err => {
console.error(err);
});
api.restoreCurrentProcessWindow().then(() => {
// console window is restored
}).catch(err => {
console.error(err);
});
`
Advanced usage
`js
api.winApiGetHwndFromPid(process.pid).then(hWnd => {
// do something with hWnd
}).catch(err => {
console.error(err);
});
api.winApiShowWindow(hWnd, api.SW_HIDE).then(() => {
// custom calls to ShowWindow
}).catch(err => {
console.error(err);
});
``