coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.78k stars 357 forks source link

Installed as Windows service the "screenshot-desktop" package takes always black image instead of the actual screen #286

Closed kwoxer closed 3 years ago

kwoxer commented 3 years ago

Describe the bug Installed as Windows service the "screenshot-desktop" package takes always black image instead of the actual screen

To Reproduce 1 Steps to reproduce the behavior:

  1. Have a server.js with screenshot-desktop
  2. Run server.js with node-windows
  3. Now the screenshot is just a black image

To Reproduce 2 Steps to check when it works:

  1. Have a server.js with screenshot-desktop
  2. Run server.js without node-windows (in command line)
  3. Now the screenshot is correct

Expected behavior The image should ALWAYS contain the current screen.

Environment (please complete the following information):

Additional context This is the command I installed the screenshot server

var Service = require('node-windows').Service;
var svc = new Service({
  name: 'Screenshot tool',
  script: 'C:\\path\\server.js'
});
svc.on('install', function(){
  svc.start();
});
svc.install();

Idea

So far what I have seen that the issue is the session ID. So the session 0 is never a real user. So it always stays black.

image

But maybe to set the resolution somewhere or changing the session ID? Is that possible maybe in this node package directly?

kwoxer commented 3 years ago

Well there is no solution. At least no simple.

The only way is to let it run with the user and hiding the server cmd window for the user.