Virtual Box COM API C ++中的TakeScreenShot成功,如何保存屏幕截图? [英] TakeScreenShot Succeeds in Virtual Box COM API C++, How to Save Screen Shot?

查看:168
本文介绍了Virtual Box COM API C ++中的TakeScreenShot成功,如何保存屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试验证我的vhd文件.我使用Virtual Box Com Api c ++进行验证工作.我的要求是,我想使用VHD创建一个vm并检查它是否正在启动,对正在运行的VM进行截屏,并将屏幕快照以jpeg格式保存在特定的截屏中,或保存在某个位置的任何图片文件格式在主机中.

下一部分我已成功完成:

I)使用给定的VHD创建了VM.
ii)已启动VM.
iii)拍摄了虚拟机的屏幕截图.

现在,如何保存屏幕截图?

以下是我所完成的.以下功能成功,接下来我该怎么做才能继续截图.
或如何使用获得的屏幕截图?

ULONG l_screenID = 0;
BYTE地址;
ULONG宽度= 32;
ULONG身高= 32;
rc = display-> TakeScreenShot(l_screenID,& address,width,height);< b></b>

Hi,

I am trying to verify my vhd file . I use Virtual Box Com Api c++ to do the verification job. My requirement is, i want to create a vm using the VHD and check if it is booting up, take screen shot of the VM that is running and save the screenshot in a particular screen shot as jpeg, or any picture file format in a location in the host machine.

The Following Part i have completed successfully :

I) Have created VM using the given VHD.
ii) Have booted up the VM.
iii) Have taken screenshot of the VM.

Now, How to save the Screenshot?

Below is upto what i have completed. the below function succeeds, What should i do next to proceed with the screenshot.
or how to use the screenshot obtained?

ULONG l_screenID = 0;
BYTE address;
ULONG width = 32;
ULONG height = 32;
rc = display->TakeScreenShot(l_screenID, &address, width, height);<b></b>

推荐答案



您为什么忽视自己对这些Virtual Box API调用进行研究?我从未使用过Virtual Box API,但是用我最喜欢的搜索引擎不到10秒钟即可找到SDK参考.

Virtual Box IDisplay [虚拟盒子论坛 [
Hi,

Why have you neglected to do the research yourself on these Virtual Box API calls? I have never used the Virtual Box API but it took less than 10 seconds to find the SDK reference using my favorite search engine.

Virtual Box IDisplay[^]

I do realize that codeproject.com is the coolest orange website on the planet but you would probably get great advice from software engineers that have experience using this API from the virtual box forum.

Virtual Box Forum[^]

I am guessing that you should do the following:

1.) Call getScreenResolution and get the width, height and bit depth.
2.) Change your BYTE into a LPBYTE and allocate the space required for the bitmap using width,height,bit depth.
3.) Call takeScreenShot or takeScreenShotToArray or perhaps takeScreenShotPNGToArray to get the bitmap bits.

Some caveats: It looks like takeScreenShot and takeScreenShotToArray always returns 32 bit bitmap bits based on SDK description. It also looks like takeScreenShotPNGToArray might be the best choice, you might even be able to dump the returned buffer into a file.

Best Wishes,
-David Delaune


这篇关于Virtual Box COM API C ++中的TakeScreenShot成功,如何保存屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆