Jump to content
  • Advertisement
Sign in to follow this  
DrGUI

[.net] Screenshot of desktop

This topic is 4975 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

I want to make a desktop-destroyer type screensaver w DX, but how do I get a screenshot to use as a texture?

Share this post


Link to post
Share on other sites
Advertisement
This will do the trick:

using Microsoft.DirectX.Direct3D;

// ...

Surface backbuffer = device.GetBackBuffer(0, 0, BackBufferType.Mono);
SurfaceLoader.Save("Screenshot.bmp", ImageFileFormat.Bmp, backbuffer);
backbuffer.Dispose();




Now you can do whatever you like with the bitmap.

Share this post


Link to post
Share on other sites
Or, perhaps easier:
1. While viewing your desktop, press print screen
2. Open paint, set the attributes of the picture to reflect the size of your desktop
3. Go to edit and choose paste
4. Save the picture

Share this post


Link to post
Share on other sites
Quote:
Original post by tool_2046
Or, perhaps easier:
1. While viewing your desktop, press print screen
2. Open paint, set the attributes of the picture to reflect the size of your desktop
3. Go to edit and choose paste
4. Save the picture


He means a current screen capture whenever the screen saver is activated.

Share this post


Link to post
Share on other sites
Quote:
Original post by kSquared
This will do the trick:

*** Source Snippet Removed ***

Now you can do whatever you like with the bitmap.

I forget to mention, the code above is in C#, if you couldn't tell. You didn't mention what language you were using, but converting it into MC++ or VB.Net should be no problem if that's what you're using.

Share this post


Link to post
Share on other sites
kSquared, I don't think he wants to actually save a bitmap, just use the desktop as a texture..

You could try making the form completely transparent, not sure if that works with full screen apps.. then just blit some things on top I guess.

Share this post


Link to post
Share on other sites
Well, kSquared's code will still work, have to change the SurfaceLoader.Save("Screenshot.bmp", ImageFileFormat.Bmp, backbuffer); line to save it to a texture in stead. Which is no biggy.

Share this post


Link to post
Share on other sites
Quote:
Original post by ontheheap
Quote:
Original post by tool_2046
Or, perhaps easier:
1. While viewing your desktop, press print screen
2. Open paint, set the attributes of the picture to reflect the size of your desktop
3. Go to edit and choose paste
4. Save the picture


He means a current screen capture whenever the screen saver is activated.

That's right, thanks. Perhaps I should have explained a little better.
I want a screenshot of the desktop just before the screensaver starts, not of my rendering with DX.

Thanx for your help.

Share this post


Link to post
Share on other sites
That looks very useful, thanks.
EDIT: but still a .NET method would be preferred.

[Edited by - DrGUI on December 4, 2004 10:10:04 AM]

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!