Advertisement
2002C Custom Controls/ Forms/ Menus #8985

A Way to take a screenshot

This code simply takes a picture of your desktop or a screenshot. I guess if you wanted to you could use this to view the desktop of a computer over a network, although that would be a bit slow. I hope this code is of some interest to some people Hope this helps.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'Add this code to the form_load event
'or whatever you want to make it occur
'Get the hWnd of the desktop
DeskhWnd& = GetDesktopWindow()
'BitBlt needs the DC to copy the image. So, we
'need the GetDC API.
DeskDC& = GetDC(DeskhWnd&)
BitBlt Form1.hDC, 0&, 0&, _
Screen.Width, Screen.Height, DeskDC&, _
0&, 0&, SRCCOPY
'This code was requested by 1 visitor to my site
'Check out my site at http://www.vbtutor.com
'Thanks
Original Comments (3)
Recovered from Wayback Machine