[vbox-dev] takecSreenShot

Valery Portnyagin valery.portnyagin at oracle.com
Tue May 21 09:32:06 GMT 2013


On 05/20/2013 01:50 PM, ???? wrote:
> I tried to take a screen shot by takecSreenShot(),,but everytime when 
> i trys it, display->TakeScreenShot fails,,and VisualBox.exe crashes....
> I am sure that I can get the correct width and height of the screen 
> "printf("Width: %ul Height: %ul Bits Per Pixel: %ul. ", 
> width,height,bpp);"......
> my vbox and SDK version are the same 4.1.6....
> please help me ...thank U!!
> ///////here is the code..........bellow
> int testTakeScreenShot(ISession *session)
> {
>     IConsole *console = NULL;
>     IDisplay *display = NULL;
>     IFramebuffer* fb=NULL;
>     unsigned long width, height, bpp;
>     SIZE_T buffersize;
>     BYTE* databuff;
>     HRESULT rc;
>     if (session == NULL)
>       return 1;
>   /* Get console object. */
>     rc=session->get_Console(&console);
>     rc=console->get_Display(&display);
> display->GetScreenResolution(0,&width,&height,&bpp);
>     printf("Width: %ul Height: %ul Bits Per Pixel: %ul. ", 
> width,height,bpp);
>     buffersize = width*height*bpp/8;
>     databuff= (BYTE*)CoTaskMemAlloc(buffersize);
>     printf("%p\n", databuff);
>
>   // Test databuffer
>   if (databuff != NULL)
>   {
>    rc = display->TakeScreenShot(0,databuff,width,height);
>    if (SUCCEEDED(rc))
>    {
>     printf("Took a screenshot! %d\n", rc);
>    }
>    else
>    {
>     printf("Error taking screen shot! rc = 0x%x\n", rc);
>    }
>    CoTaskMemFree(databuff);
>   }
>  return 0;
> }
>
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev

Hello,
just for interest,
what was the value of bpp (Bits Per Pixel) in your case?

-- 
Valery Portnyagin | VirtualBox Developer | (+7 812) 334 64 26
Oracle Development SPB
10th Krasnoarmeyskaya 22A, Saint-Petersburg, 190103, Russia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130521/32340a30/attachment.html>


More information about the vbox-dev mailing list