[.net] Screenshot of desktop
I want to make a desktop-destroyer type screensaver w DX, but how do I get a screenshot to use as a texture?
This will do the trick:
Now you can do whatever you like with the bitmap.
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.
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
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
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.
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.
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.
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.
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.
Quote:Original post by ontheheapQuote: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.
http://www.c-sharpcorner.com/Code/2003/Dec/ScreenCapture.asp
is an example I found that uses pinvoke on GDI32 nad User32.
is an example I found that uses pinvoke on GDI32 nad User32.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement