waitingsong / node-win32-api

win32 api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to make an application invisible in the background?

CarmenLexa opened this issue · comments

I am using the following code to call a windows application

var { spawn } = require('child_process');
const local_path = "C:\\Users\\PC\\\Documents\\";
const query = exec("start /B game.exe", { cwd: `${local_path}`,windowsHide: true });
const pid = query.pid;

how can i use win32-api?

commented

try:https://www.npmjs.com/package/hmc-win32
The module is a deeply wrapped win32-api

const hmc = require('hmc-win32');
 hmc.openApp("game.exe","",`${local_path}`,true,false);

Hide the current console:

// Please save it to a variable if you need to continue to control it, because after hiding the handle will be blocked so that it cannot be retrieved.
let Handle = hmc.getProcessHandle(process.pid);
Handle?.hide();
// show 
Handle?.show();```