I'm trying to take screen shot of the virtual machine using c++. The code is like this.
Code: Select all
display->GetScreenResolution(0,&width,&height,&bpp);
buffersize = width*height*4;
databuff = (BYTE*)CoTaskMemAlloc(buffersize);
rc = display->TakeScreenShot(0,databuff,width,height);
It does not depend on the amount of memory allocated, I tried to allocate much more - still crashes. Also does not depend on width and height passed to TakeScreenShot - crashes with values much smaller than actual display dimentions.
Does some one have an idea what is going on?
While googling, I noticed people faced same situation before, but found no sane answer what to do.
IDisplay::TakeScreetShotToArray works fine, but it is sooooooooo slow....