Sign in to follow this  
DrGUI

[.net] Screenshot of desktop

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this