Hello everyone, I wanted to ask a question here, in the hope that they would help. I recently wanted to make a program that scrolls the game screen, I read everything, watched some articles, and so I came to this code
D3DDEVICE_CREATION_PARAMETERS cparams; RECT rect; m_pDevice->GetCreationParameters(&cparams); GetWindowRect(cparams.hFocusWindow, &rect); IDirect3DSurface9* pBackBuffer, *pSurfTemp; HRESULT hRes = m_pDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer); hRes = m_pDevice->CreateOffscreenPlainSurface(rect.right - rect.left, rect.top - rect.bottom, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurfTemp, NULL ); hRes = m_pDevice->GetRenderTargetData(pBackBuffer, pSurfTemp); D3DXSaveSurfaceToFile("D:\\output.jpg", D3DXIFF_JPG, pBackBuffer, NULL, NULL); SAFE_RELEASE(pBackBuffer); SAFE_RELEASE(pSurfTemp);
I inject into the DLL process, after I intercept EndScene, and get every frame with LPDIRECT3DDEVICE9. Well, what's the matter, he kind of scans the game, but after the screenshot the game crashes and crashes, but the screenshot turns out, I don’t know what all the fuss is, if anyone knows how to solve this problem, I will be very grateful to them.