Trying to capture the screen, Getting some Error
-
Hi, Here iam trying to capture the screen , i included d3dx8tex.lib, d3d8 in the project. Iam using Vc++ 6.0 and DirectX 9. In my dailog box when i click on button (Screen button) trying to capture the screen. In run time when i click on the button iam getting an error, can any body tell me what is the problem or is there any other solution using DirectX #include #include typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8; typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8; void CMainclass::OnScreen() { LPDIRECT3DDEVICE8 pDevice ; LPDIRECT3DSURFACE8 pSurface ; LPDIRECT3DSURFACE8 pFrontSurface = NULL; pDevice->GetFrontBuffer( pSurface ); //Here iam getting error D3DXSaveSurfaceToFile( "ScreenShot.bmp", D3DXIFF_BMP, pFrontSurface, NULL, NULL ); } Thanks in Advance Santosh
-
Hi, Here iam trying to capture the screen , i included d3dx8tex.lib, d3d8 in the project. Iam using Vc++ 6.0 and DirectX 9. In my dailog box when i click on button (Screen button) trying to capture the screen. In run time when i click on the button iam getting an error, can any body tell me what is the problem or is there any other solution using DirectX #include #include typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8; typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8; void CMainclass::OnScreen() { LPDIRECT3DDEVICE8 pDevice ; LPDIRECT3DSURFACE8 pSurface ; LPDIRECT3DSURFACE8 pFrontSurface = NULL; pDevice->GetFrontBuffer( pSurface ); //Here iam getting error D3DXSaveSurfaceToFile( "ScreenShot.bmp", D3DXIFF_BMP, pFrontSurface, NULL, NULL ); } Thanks in Advance Santosh
First off, what error are you getting?! There is another soulition, Call GetDC(NULL) to get a device context to the "desktop" window (ie the entire screen). This DC will have a bitmap selected into it that represents the screen, all you need to do is pull the bitmap out, and save it to a file.