Am new to this DirectX programming. Recently i have installed DirectX9 & setup with VS 2008. Am trying to take screenshot of Desktop ( client area i.e., not entire desktop, only specified region on desktop ). I've googled on this & found a peice of code.
int ScreenWidth = 100;
int ScreenHeight = 100;
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL);
And in Linker Properties -> Input I've refrenced d3d9.lib d3dx9.lib. In project folder, I've kept d3d9.dll, d3d9.lib & d3dx9.lib files.
But when i run the program, it crashes at CreateOffscreenPlainSurface function stating that Access violation. Am not getting what am doing wrong with this. And also i've specified the Image width & HEight. But how do i specify the client region i.e., x & y cordinate.
Please suggest me on this.
Thank you all..