I have recently made an application that takes screenshots of games.
First I used GDI to capture the game but for that I had to disable aero at win7/vis and I had some issues on windows XP.
Than I decided going with DirectX and after realizing that microsoft's DX isn't going to work for me, I found this great example of a SlimDX screen capture (http://spazzarama.wordpress.com/2009/02/07/screencapture-with-direct3d/)
SlimDX worked GREAT! and it even allowed me to capture a game without having to disable aero on win7/vis.
Only problem is - when I switch the game to fullscreen I get "D3DERR_DEVICELOST: Device lost (-2005530520)".
Can anyone suggest a way to customize the code so it'll capture fullscreen application?
NOTE : I already have a method that can determine if the game is fullscreen or windowed.
And I change this line :
bitmap = new Bitmap(SlimDX.Direct3D9.Surface.ToStream(surface, SlimDX.Direct3D9.ImageFileFormat.Bmp, new Rectangle(region.Left, region.Top, region.Width, region.Height)));
to this :
bitmap = new Bitmap(SlimDX.Direct3D9.Surface.ToStream(surface, SlimDX.Direct3D9.ImageFileFormat.Bmp));