Jump to content
  • Advertisement
Sign in to follow this  
lendren

take screenshot on secondary screen

This topic is 977 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, 

 

How can I take a screenshot on my secondary screen?

Thats what i have.

public Bitmap CaptureScreen()
        {
            using(Surface s = Surface.CreateOffscreenPlain(d, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Format.A8R8G8B8, 
            Pool.SystemMemory))
            {
                d.GetFrontBufferData(0, s);
                Bitmap b = new Bitmap(SlimDX.Direct3D9.Surface.ToStream(s, SlimDX.Direct3D9.ImageFileFormat.Bmp, new Rectangle(222, 222, 500, 500)));

                s.Dispose();
                return b;
            }
        }

This works great, but only for my main display.

I could not find anything useful with Google.

Please help me.

 

Thanks and Greetings

Edited by lendren

Share this post


Link to post
Share on other sites
Advertisement

That's weird because slimDX fully supports Direct3D 9.0c, 9.0 Ex, 10.0, 10.1, 11 which include a function to save a surface directly to file... Perhaps a little more context with your question would be helpful instead of down voting an answer with as much context as your question. It doesn't matter what display you are outputting to, all you need is a surface.

 

Also I assume you are using multiple swap chains because you are rendering to two different windows. You have to GetFrontBufferData() from the swap chain that is used to draw to your other window.

Edited by ExErvus

Share this post


Link to post
Share on other sites

I can take a screenshot. Its working fine for me. I just dont know how i can take a screenshot from my second desktop. 

 

 

I tried "Screen.AllScreens" without success.

Edited by lendren

Share this post


Link to post
Share on other sites

Would you be able to post a few sections of the pertinent code? like where is 'd' defined? And what methods are you using to draw to the second monitor?

Share this post


Link to post
Share on other sites

try d.GetFrontBufferData(1, s); instead of d.GetFrontBufferData(0, s);

Also the more of your source you post the more we can help

Share this post


Link to post
Share on other sites

That's the whole project.

Just want to take a screenshot from my main and secondary display with directx.

 

After changing to d.GetFrontBufferData(1, s);  i got this error:

 

 

D3DERR_INVALIDCALL: Invalid call (-2005530516)

Edited by lendren

Share this post


Link to post
Share on other sites

Wait are you trying to take a picture of your desktop on your second monitor? As in your not trying to make a game or graphical program?

Also it is not possible for that to be your whole project. It sounds like your level of understanding of programming and software is at a point to where you need to keep teaching your self first by going through the basics before jumping straight into directx. This includes debugging techniques, research techiniques and understanding how to search documentation for a solution to your problem. I want to help you but there is a lack of information to your question.

Edited by ExErvus

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!