screenshot help!

v8maro

Newcomer
Joined
Feb 24, 2009
Messages
3
Hey guys, i'm a total newb to d3d, but I'm hoping what I am asking is fairly simple.

I have a c# application, I have referenced the required DirectX dll's.

I now have a video game running, in D3D.

I want the c# application to take a screen shot of what I see in-game.

This is what I have so far, and I'm kind of lost. Can anyone help me?


IntPtr hWnd = new IntPtr();

foreach (AdapterInformation adapter in Manager.Adapters)
{
// Check whether or not this is the default adapter
if (adapter.Equals(Manager.Adapters.Default))
{
hWnd = Manager.GetAdapterMonitor(adapter.Adapter);
}
}

if (hWnd != null)
{
Device device = new Device(hWnd);

try
{
Surface renderTarget = device.GetBackBuffer(0, 0, BackBufferType.Mono);
SurfaceLoader.SaveToStream(ImageFileFormat.Jpg, renderTarget);
}
catch (AccessViolationException avex)
{
avex.Data.Clear();
}
}



My code is obviously flawed, however, I'm not good with this d3d stuff. I realize I am CREATING a new device, which I do not want to do. How do I access the existing application(game) device, and then take a screen shot of it?

Thanks!

Steve
 
Last edited:
Back
Top