screenshot

  • Thread starter Thread starter Timothy Taylor
  • Start date Start date
Thanks, this helps, however, What i was hoping for was VB.NET code to
take a snapshot of the screen and put it into a picturebox or something
all on the device without a PC. I want a PPC version of the PC Print
Screen button.

Thanks,

-Tim
 
There isn't an east way to do it. You have to get the entire screen rect,
create a DIB, and save it to a file, then load that file into a Bitmap
class.

-Chris
 
Unfortunately, this is true and it is not trivial - you could base a
dissertation on it. The steps look something like this...

1. GetDC from the window hwnd
2. Use CreateCompatibleDC to create a memory DC based on the DC from 1
3. Use CreateDIBSection to access the "bits" of the window's image
4. Use SelectObject to select the dib section into the memory DC
5. BitBlt the image from the window DC into the memory DC
6. Copy the DIB section bits to a buffer (you got a pointer in 3)
7. Reselect the previous bitmap (returned from 4) into the memory DC with
SelectObject
8. DeleteObject on the dib section

Now you can save the BITMAPFILEHEADER, BITMAPINFOHEADER, and dib section to
a file. One caveat is that the DC of the window holds 16-bit pixel data
packed as 555 or 565 so you need to use the biCompression member and specify
the masking of the RGB components.

Fortunately, loading it is easy! You can just load it right into a Bitmap
object. I hope this helps.
--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no rights.
 
You can ignore my caveat. I did some tests and you can specify different
formats for the DIB section and the device context appears to handle it
quite well during blitting.

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top