node-win32-api icon indicating copy to clipboard operation
node-win32-api copied to clipboard

How to make an application invisible in the background?

Open CarmenLexa opened this issue 2 years ago • 2 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?

CarmenLexa avatar Jan 24 '23 04:01 CarmenLexa

try: https://github.com/waitingsong/node-windows-window-controller/blob/master/src/lib/index.ts#L11

waitingsong avatar Jan 30 '23 03:01 waitingsong

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();```

kihlh avatar Feb 11 '23 14:02 kihlh