• Content count

  • Joined

  • Last visited

Community Reputation

105 Neutral

About aramcpp

  • Rank
  1. Screenshot of game window

    i wont a screenshot of a different game
  2. How can i take a screenshot of a full screen game in c++? I know it can be done with directx and i have written a simple code which can take a screenshot of a window but i don't know how to get a HWND of game. Here is my code.     #include <d3dx9.h>     #include <d3dx9tex.h>     #include <stdio.h>          #pragma comment(lib,"d3d9.lib")     #pragma comment(lib,"d3dx9.lib")          int main()     {         IDirect3DSurface9 *surface;         IDirect3DDevice9 *g_pd3dDevice;         IDirect3D9 *g_pD3D;         D3DDISPLAYMODE d3ddm;         D3DPRESENT_PARAMETERS d3dpp;         HWND hWnd = GetConsoleWindow();              if((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)         {             printf("fail 1");         }              if(FAILED(g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))         {             printf("fail 2");         }              ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS));              d3dpp.Windowed = TRUE;         d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;         d3dpp.BackBufferFormat = d3ddm.Format;         d3dpp.BackBufferHeight = d3ddm.Height;         d3dpp.BackBufferWidth = d3ddm.Width;              if(FAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT,                                        D3DDEVTYPE_HAL, hWnd,                                        D3DCREATE_SOFTWARE_VERTEXPROCESSING,                                        &d3dpp, &g_pd3dDevice)))         {             printf("fail 3");         }         g_pd3dDevice->CreateOffscreenPlainSurface(800, 600, D3DFMT_A8R8G8B8,     D3DPOOL_SCRATCH, &surface, NULL);         g_pd3dDevice->GetFrontBufferData(0, surface);         D3DXSaveSurfaceToFile("c:\\tmp\\output.jpg", D3DXIFF_JPG, surface, NULL, NULL);         surface->Release();         return 0;     }
  3. Can anybody show me a little program written without using ExampleApplication?