Code:
IDirect3DSurface9 *pSurface;
LPD3DXBUFFER pBuffer;
pDevice->CreateOffscreenPlainSurface(screen_size.x, screen_size.y, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL);
pDevice->GetFrontBufferData(0, pSurface);
D3DXSaveSurfaceToFileInMemory(&pBuffer, D3DXIFF_JPG, pSurface, NULL, NULL);
pSurface->Release();

//Now have fun with:
//pBuffer->GetBufferSize();
//pBuffer->GetBufferPointer();



And then do all your compression stuff. (Its saved as JPG, you might use BMP/PNG if you wanna use another compression)
This is still slower then coding your own device driver like Teamviewer did.

Last edited by Ch40zzC0d3r; 11/04/15 19:55.