XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Take DirectX Screenshots from External Application with C#

Last post 1/31/2010 11:24 AM by Guy Ronen. 4 replies.
  • 11/25/2009 1:47 AM

    Take DirectX Screenshots from External Application with C#

    Hey,
    I apologize if this is in the wrong spot but I didn't know where else to put it.  What I am trying to do is take screenshots of a 3rd party application while it is running and since I've never really used DirectX, it's quite confusing.  The main reason I want to use direct x is because if I use built in windows functions, the screenshots turn out black most of the time.  I read that using Direct X could solve this.

    I've tried using things like the line below, but I cant get it to work. My problem is that I need to specify which application I actually want to take a screenshot of and cant figure it out. If anyone could help me, I would greatly appreciate it. Thanks a bunch.

    s = device.GetBackBuffer(0, 0, Microsoft.DirectX.Direct3D.BackBufferType.Mono);

    Also note, I am trying to do this C#, .net 2.0, and the latest release of Direct X.  Thanks again.
  • 11/25/2009 4:29 AM In reply to

    Re: Take DirectX Screenshots from External Application with C#

    Do you just need a screenshot?  Or do you actually have to program the feature yourself?  FRAPs will do screenshots and videos for you for free (with a few limitations on the free version).
  • 11/26/2009 1:36 AM In reply to

    Re: Take DirectX Screenshots from External Application with C#

    i need to write the feature myself in c# :-(
  • 11/26/2009 5:14 PM In reply to

    Re: Take DirectX Screenshots from External Application with C#

    Unfortunately, I don't know of an easy way to do this.  Programs run in their own process space and they don't like to easily share data.  The technique for getting into another running process' code is called DLL Hooking.  I won't say that it isn't possible with C#, just that I have never tried something so low level with it.

    If you are interested in DLL Hooking, I recomend Windows via C++ by Jeffrey Richter (http://www.amazon.com/Windows-via-Pro-Jeffrey-Richter/dp/0735624240).  He has some pretty good material on the subject.
  • 1/31/2010 11:24 AM In reply to

    Re: Take DirectX Screenshots from External Application with C#


    Hi,
    Did you manage to do it after all?
    If so, I need to do somthing similar, so it will be great if you'll share your solution.
    Thanks.
Page 1 of 1 (5 items) Previous Next