Click here to Skip to main content
15,909,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to try to do a screen capture software.
But I don't know where to start.

The software of things to do:

Screen data storage for video data.
You can play it again.
Another host can also see my screen.

Please help me on this.
Posted
Updated 9-Apr-12 2:42am
v2

If you Google, you will find many. I am providing you few, hope these helps :

1. Various methods for capturing the screen[^]
2. Barry's Screen Capture[^]
3. Screen Capture (Simple Win32 Dialog Based)[^]
 
Share this answer
 
Here is a simple d3d screen capture, you may need d3d9.h from your d3d install in your resources folder:

C++
// usage: TakeScreenShot("C:\\Yourname.bmp");
void TakeScreenShot(char* file_name)
{
    LPDIRECT3D8 pD3D = NULL;
    LPDIRECT3DDEVICE8 device = NULL;
    pD3D = Direct3DCreate8( D3D_SDK_VERSION );
    int nMode = 0;
    D3DDISPLAYMODE d3ddm;
    bool bDesiredAdaptorModeFound = false;
    int nMaxAdaptorModes = pD3D->GetAdapterModeCount( 0 ); //0, 22
    for( nMode = 0; nMode < nMaxAdaptorModes; ++nMode )    {
        pD3D->EnumAdapterModes( D3DADAPTER_DEFAULT, nMode, &d3ddm );
        if( d3ddm.Width != 640 || d3ddm.Height != 480 )
            continue;
        if( d3ddm.Format != D3DFMT_X8R8G8B8 )
            continue;
        if( d3ddm.RefreshRate != 75 )
            continue;
        bDesiredAdaptorModeFound = true;
        break;
    }
    pD3D->CheckDeviceType( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, FALSE );
    pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D16 );
        D3DCAPS8 d3dCaps;    
    pD3D->GetDeviceCaps( D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, &d3dCaps );    
    DWORD dwBehaviorFlags = 0;
    if( d3dCaps.VertexProcessingCaps != 0 )
        dwBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
    else
        dwBehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
    D3DPRESENT_PARAMETERS d3dpp;
    memset(&d3dpp, 0, sizeof(d3dpp));
    d3dpp.Windowed               = TRUE;
    d3dpp.EnableAutoDepthStencil = TRUE;
    d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
    d3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferWidth        = 1600;
    d3dpp.BackBufferHeight       = 1200;
    d3dpp.BackBufferFormat       = D3DFMT_X8R8G8B8;
    pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetDesktopWindow(), dwBehaviorFlags, &d3dpp, &device );  //Gets Desktop Area
    int screenx = GetSystemMetrics(SM_CXSCREEN);
    int screeny = GetSystemMetrics(SM_CYSCREEN);
    LPDIRECT3DSURFACE8 frontbuf = 0;
    device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &frontbuf);
    device->CreateImageSurface(screenx, screeny, D3DFMT_A8R8G8B8, &frontbuf);
    HRESULT hr = device->GetFrontBuffer(frontbuf);
    D3DXSaveSurfaceToFile(file_name, D3DXIFF_BMP, frontbuf, NULL, NULL);
    frontbuf->Release();
    device->Release();
    pD3D->Release();
}  
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900