Screen Capture of Headless Virtualbox Emulator

Discussions related to using VirtualBox on Windows hosts.
Post Reply
MeleaB
Posts: 5
Joined: 7. Dec 2017, 03:49

Screen Capture of Headless Virtualbox Emulator

Post by MeleaB »

Hi.

I am trying to capture the contents of an Android emulator, called MOMO. It is run by VirtualBox Headless Frontend.

I've written a program that uses Gdip_BitmapFromHWND (part of the AutoHotKey scriptting language) to create a bitmap screenshot of any window (even if the window is hidden or off-screen, which is essential) from which I test for certain pixel colours. On my desktop it works fine, including- most importantly- on the MOMO Android emulator on which it is used in order to read pixels from a game. However, on my laptop and for some others, although it can capture the images of other [non-emulator] windows (Notepad, Paint etc) it has a problem with the image from the emulator. Instead of the image that is visible on the screen, it returns an image which is shown during the start-up of the emulator (a full screen advertisement for a game.)

I've spent hours and hours trying to learn/research and discover the problem, but so far to no avail. I thought it may be a DirectX v OpenGL rendering issue, but I've since learned that the MOMO emulator doesn't yet support DiectX. As mentioned, the emulator run in a VirtualBox Headless environment and so I wondered if the problem lay there. I've read some people have had problems with VirtualBox getting the inbuilt SnapShot function working- an issue that goes back years from what I see- and so I didn't know if that was perhaps related. I am a novice with regards to VirtualBox and I hoped someone here may be able to suggest where the problem lay.

Cliffnotes:
-I can capture Bitmap screenshot of VirtualBox Headless emulator on my Desktop (even, most importantly, when the window is hidden or off-screen)
-I *can't* capture Bitmap screenshot of VirtualBox Headless emulator on some other PCs (instead a different image appears- NOT what is visible on the screen.)
-HELP!

Thanks! :)
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Screen Capture of Headless Virtualbox Emulator

Post by socratis »

MeleaB wrote:I am trying to capture the contents of an Android emulator, called MOMO.
I couldn't find anything related to "MOMO Android". I could however find an Android emulator called "MEMU". Are you sure you're not referring to that one? Plus, Android is not a supported guest. And to tell you the truth, I'm not sure how you're going to grab a screenshot from something that doesn't have a screen.

In any event, if this issue is not observed with a straight, clean, standalone installation of VirtualBox, I'm afraid you'll have to ask them for support.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
MeleaB
Posts: 5
Joined: 7. Dec 2017, 03:49

Re: Screen Capture of Headless Virtualbox Emulator

Post by MeleaB »

Hi. Thanks for the reply.

Memu is a different emulator. MOMO is found here, in Chinese: momoplayer dot com

A bitmap can be captured of the MOMO emulator like any other window using it's handle. Gdip_BitmapFromHWND uses PrintWindow to repaint the contents of the window and create the Bitmap. So even if it's hidden or off screen you can still take a "screenshot" of the window.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Screen Capture of Headless Virtualbox Emulator

Post by socratis »

I think you may need to talk to the MOMO developers about this. As I already said:
socratis wrote:In any event, if this issue is not observed with a straight, clean, standalone installation of VirtualBox, I'm afraid you'll have to ask them for support.
Oh, and if you talk to them, please remind them that VirtualBox is released under the GPL, so any modifications they've made (which they have), they need to release the source code for those. Otherwise they're violating the GPL. Just saying...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
MeleaB
Posts: 5
Joined: 7. Dec 2017, 03:49

Re: Screen Capture of Headless Virtualbox Emulator

Post by MeleaB »

They appear to be a small (one man?) Chinese operation. Their support doesn't appear to be too helpful at responding to questions.

My hope was that someone here with knowledge of the VirtualBox screenshot issues (that I'd read about) would at least be able to confirm (or otherwise) that those bugs could be the cause of the problem I'm having. I've hit repeated dead-ends with my hours and hours of looking into this problem, and I don't know if I just need to give up with trying to find the cause/solution. Thx.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Screen Capture of Headless Virtualbox Emulator

Post by socratis »

I'll say it for another time; if you can get this behavior with a standalone VirtualBox version, please do. And post some sample code for a developer to have a look at it.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
MeleaB
Posts: 5
Joined: 7. Dec 2017, 03:49

Re: Screen Capture of Headless Virtualbox Emulator

Post by MeleaB »

I'm quite capable of reading. What I lack is any experience with VirtualBox, hence my questions aimed at trying to understand better. But I'll take your advice and learn Chinese so that I can inform the MOMO developer that VirtualBox is released under the GPL, so for any modifications they've made they need to release the source code otherwise they're violating the GPL. Then I'll focus on developing some code to hopefully reproduce the issue for a standalone VirtualBox which has little to do with what I'm trying to find an answer for.

Thanks for the pointers.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Screen Capture of Headless Virtualbox Emulator

Post by socratis »

MeleaB wrote:Then I'll focus on developing some code
I thought that you already had done so:
MeleaB wrote:I've written a program that uses Gdip_BitmapFromHWND
You could definitely try that with a stand alone version of VirtualBox and a headless VM.
MeleaB wrote:But I'll take your advice and learn Chinese so that I can inform the MOMO developer that VirtualBox is released under the GPL
Great! Because I don't have the time and most importantly the patience...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
MeleaB
Posts: 5
Joined: 7. Dec 2017, 03:49

Re: Screen Capture of Headless Virtualbox Emulator

Post by MeleaB »

socratis wrote:
MeleaB wrote:But I'll take your advice and learn Chinese so that I can inform the MOMO developer that VirtualBox is released under the GPL
Great! Because I don't have the time and most importantly the patience...
Ha :)
socratis wrote:
MeleaB wrote:Then I'll focus on developing some code
I thought that you already had done so:
MeleaB wrote:I've written a program that uses Gdip_BitmapFromHWND
You could definitely try that with a stand alone version of VirtualBox and a headless VM.
Yes, that's correct. OK, I think my lack of VirtualBox knowledge (and virtual machines in general) is causing me some confusion. I shall read up to gain a better understanding and see if get anywhere with what you suggest. Cheers.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Screen Capture of Headless Virtualbox Emulator

Post by socratis »

As I have mentioned, come with a small program that shows the problem purely with VirtualBox, and then you could post your question to the developer mailing list.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply