I have the two monitors with my extended windows desktop. InvalidateRect(((CMainFrame*)(pApp->m_pMainWnd))->m_hWnd,NULL,false) įor more clarity about the problem I have and the solution: Memcpy((BYTE*)pSinfo->pData, (BYTE*)pSinfo->lockedRect.pBits, (pSinfo->uiWidth) * pSinfo->uiHeight * pSinfo->uiBitsPerPixels/8) PSinfo->pRenderSurface->LockRect(&pSinfo->lockedRect,NULL, D3DLOCK_READONLY) ZeroMemory(&pSinfo->lockedRect, sizeof(D3DLOCKED_RECT)) D3DXSaveSurfaceToFile("Desktop.bmp", D3DXIFF_BMP, pSinfo->pRenderSurface,NULL, NULL) //Test PSinfo->g_pd3dDevice->GetFrontBufferData(0, pSinfo->pRenderSurface) PSinfo->g_pd3dDevice->CreateOffscreenPlainSurface(pSinfo->uiWidth, pSinfo->uiHeight, pSinfo->d3dFormat, D3DPOOL_SYSTEMMEM, &pSinfo->pRenderSurface, NULL) PSinfo->g_pd3dDevice->GetRenderTarget(0, &pSinfo->pRenderSurface) If( pSinfo->g_pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_REF,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING ,&d3dPresentationParameters,&pSinfo->g_pd3dDevice) != D3D_OK )Īnd then, the loop which perform continuous screenshots and save image data in pData: while(1) PSinfo->uiHeight = d3dDisplayMode.Height ZeroMemory(&d3dPresentationParameters,sizeof(D3DPRESENT_PARAMETERS)) ĭ3dPresentationParameters.Windowed = TRUE ĭ3dPresentationParameters.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER ĭ3dPresentationParameters.BackBufferFormat = d3dDisplayMode.Format ĭ3dPresentationParameters.BackBufferHeight = gScreenRect.bottom = d3dDisplayMode.Height ĭ3dPresentationParameters.BackBufferWidth = gScreenRect.right = d3dDisplayMode.Width ĭ3dPresentationParameters.MultiSampleType = D3DMULTISAMPLE_NONE ĭ3dPresentationParameters.SwapEffect= D3DSWAPEFFECT_DISCARD ĭ3dPresentationParameters.hDeviceWindow = hWnd ĭ3dPresentationParameters.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT ĭ3dPresentationParameters.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT If( pSinfo->g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3dDisplayMode) = D3DERR_INVALIDCALL ) If( (pSinfo->g_pD3D=Direct3DCreate9(D3D_SDK_VERSION)) = NULL ) How can I adapt this solution for a dual screen capture ?įirst of all, I initialize Direct3D: D3DDISPLAYMODE d3dDisplayMode ĭ3DPRESENT_PARAMETERS d3dPresentationParameters //Presentation parameters (backbufferwidth, height.) The following code works well but I am just able to capture the primary display and not the extended desktop (just one screen is captured twice) I am currently developing an application with Direct3D in order to capture my two monitors desktop (used as extended desktop of course).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |