Click here to Skip to main content
15,896,545 members

Comments by Member 11806482 (Top 3 by date)

Member 11806482 8-Jul-15 14:49pm View    
I also changed my code to this:


void captureScreenD3d()
{
UINT screenW = GetSystemMetrics(SM_CXSCREEN);
UINT screenH = GetSystemMetrics(SM_CYSCREEN);

IDirect3DSurface9* pbackBuffer;
d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pbackBuffer, NULL);

d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pbackBuffer);

D3DXSaveSurfaceToFile(L"screen.bmp", D3DXIFF_BMP, pbackBuffer, NULL, NULL);


pbackBuffer->Release();
}


Now it returns a black screen for every application, not just fullscreen games. Initial GetFrontBuffer worked fine for everything else. Just returned blackscreen for fullscreen games.
What am I doing wrong here?
Member 11806482 8-Jul-15 14:12pm View    
So I should change d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL); to d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pSurface, NULL); ?

I also changed it to
d3ddev->CreateOffscreenPlainSurface(screenW, screenH, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, NULL);

I did this. But it is still returning a black screen. I apologize if I am sounding novice and I interpreted your solution incorrectly. I am new to DirectX programming.
Member 11806482 8-Jul-15 4:00am View    
I am also trying to write a screencapture application.
I hope you figured out how to get rid of the black screen by now.
[Here](http://stackoverflow.com/q/31286503/4794952) is a link to my problem. I am presently using GetFrontBufferData. If the solution given above worked for you please let me know.