1

I want to take a screenshot of Nox Player or MEmu Player. I tried everything in this topic: Get a screenshot of a specific application but still stuck.

In followed the best answer (that with green check symbol), I can take a screenshot but as has a problem: - The target window must be in foreground and not covered by anything.

I tried the next solution (in next comment) using PrintWindow win32. Here is my code when I click a button:

var proc = Process.GetProcessesByName("Nox")[0];
Bitmap bmp = PrintWindow(this.Handle);
pictureBox.Image = bmp;

But the RECT always return 0 for all variable Left, Top, Right, Bottom.

KaZaT
  • 254
  • 2
  • 15
  • That's because the target window must be in the foreground and not covered by anything, which results in the RECT returning 0 for left/top/right/bottom, because it is not visible. You would have to temporarily bring the screen to the foreground to be able to make a screenshot (screen .... shot... it's in the name hehehe) – zuckerburg Dec 13 '18 at 13:08
  • I've done this before, and I had to get the app to the foreground first before being able to take a screenshot. – zuckerburg Dec 13 '18 at 13:19
  • I know. But the second comment say: The PrintWindow win32 api will capture a window bitmap even if the window is covered by other windows or if it is off screen – KaZaT Dec 13 '18 at 13:32
  • Yes, and people don't always know what they're talking about, hence it not being marked as the answer. All I'm saying is, from my experience, not having the window visible won't result in a screenshot. You would need to focus on the app for long enough to take a screenshot, and if you'd like, minimize it again. – zuckerburg Dec 14 '18 at 12:50

0 Answers0