Click here to Skip to main content
15,886,199 members

Comments by Guru_C++ (Top 79 by date)

Guru_C++ 29-Apr-13 1:59am View    
yes.. It solved me.. Thank you.
Guru_C++ 19-Feb-13 2:07am View    
No.. hWnd is the handle of the Main MFC application window. I will try to find the window of the CTab1Dlg.. Is there any API's to find the window of Property pages ? Am not sure, Recently i 've learnt the Property pages & implementing it .
Guru_C++ 14-Feb-13 5:50am View    
How to write that WM_PRININT messages. I dont have any idea about that..
Guru_C++ 13-Feb-13 6:42am View    
ok Thank you,.. I will check it out :)
Guru_C++ 13-Feb-13 5:17am View    
Hello Maxim, Thanks for replying.. I modified this code as per as your suggestion. The snippet code looks like this:

void ScreenShot()
{
IDirect3DDevice9* pDirect3DDevice;

IDirect3DSurface9* pRenderTarget=NULL;
IDirect3DSurface9* pDestTarget=NULL;

D3DDISPLAYMODE d3ddisplaymode;

D3DPRESENT_PARAMETERS PresentParams;
memset(&PresentParams, 0, sizeof(D3DPRESENT_PARAMETERS));

PresentParams.Windowed = TRUE;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;

IDirect3D9* direct=Direct3DCreate9(D3D9b_SDK_VERSION);
direct->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
GetDesktopWindow(),
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&PresentParams,&pDirect3DDevice);

if (pDirect3DDevice == NULL)
return;

HRESULT hr = pDirect3DDevice->GetRenderTarget(0, &pRenderTarget);

hr = direct->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddisplaymode);

hr = pDirect3DDevice->CreateOffscreenPlainSurface(d3ddisplaymode.Width,d3ddisplaymode.Height,D3DFMT_A8R8G8B8,
D3DPOOL_SYSTEMMEM,
&pDestTarget,
NULL);

pDirect3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pDestTarget ) ;

hr = pDirect3DDevice->GetRenderTargetData(pRenderTarget,pDestTarget);

hr = D3DXSaveSurfaceToFile("E:\\abc.bmp",
D3DXIFF_BMP,
pDestTarget,
NULL,
NULL);

pRenderTarget->Release();
pDestTarget->Release();

}

But Still i use to get black image .. I dont know whats wrong is happening :(