https://bugs.winehq.org/show_bug.cgi?id=46257
Bug ID: 46257 Summary: PrintWindow returns black image Product: Wine Version: 3.17 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: stu.axon@gmail.com Distribution: ---
On Windows I can get an image of a win32 window using PrintWindow, on Wine it just returns a black image of the size of the window.
I ran this code
https://stackoverflow.com/questions/19695214/python-screenshot-of-inactive-w...
And changed the app from Calculator (which is Universal in Windows now) to Notepad.
https://bugs.winehq.org/show_bug.cgi?id=46257
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- Could you attach a test program to reproduce this?
https://bugs.winehq.org/show_bug.cgi?id=46257
--- Comment #2 from Stuart Axon stu.axon@gmail.com --- Here's the code I use to grab the screenshot https://gist.github.com/stuaxo/70e00c1535d4348196969af6dd4d731d
It's python though, it might take a bit longer to get something together with C/C++ as I don't really know what I'm doing when it comes to that or windows development.
https://bugs.winehq.org/show_bug.cgi?id=46257
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Ok, what do I need to install in Wine prefix to run this?
https://bugs.winehq.org/show_bug.cgi?id=46257
--- Comment #4 from Stuart Axon stu.axon@gmail.com --- I'm having a go at something in C++, I'll try and come back with the detailed python install instructions and a single file you can run, it got complicated by a few bugs.
The short version is, installing python3.5 or 3.6. then using pip to install pywin32.
(I would recommend python2.7, but there seemed to be a bug in pywin32 that prevented this).
I had to use wine-staging as there was a bug stopping install of 3.5 or 3.6.
Once it's installed use pip to install pywin32.
...
Except this may not work, I managed to make a patch to pip that made this able to work in Wine.
I'll do it again and document it here, but if you manage to get any version of python installed under wine with pywin32, let me know - alternately just wait for further info :)
https://bugs.winehq.org/show_bug.cgi?id=46257
--- Comment #5 from Stuart Axon stu.axon@gmail.com --- Hi, Here is some CPP code that grabs a screenshot of a window. It's not the same as the python code, but grabbing screenshots does fail under Wine.
Thought I had an MFC version (a port of the python code) working before, Xmas .. but definitely isn't working now, so I've commented that out (and probably broken more things).
https://gist.github.com/stuaxo/cba5921832201c93a0de1da28aeffcff
Code is a bit of a mishmash of C/C++ idioms as it's code-by-googling
You can run notepad then capture it like
capture-window -l Notepad
https://bugs.winehq.org/show_bug.cgi?id=46257
--- Comment #6 from Stuart Axon stu.axon@gmail.com --- Replaced the example code with something slightly better
https://github.com/stuaxo/capture_window/