Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Trying to capture the screen, Getting some Error

Trying to capture the screen, Getting some Error

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++graphicsgame-devquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    santosh k
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • S santosh k

      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

      D Offline
      D Offline
      Diddy
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups