by Steven Ayre (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(4 Votes)
Takes a screenshot of the screen using the Windows API. The subroutine ScreenShot takes a screenshot of the entire screen, the subroutine PartialScreenShot takes a screenshot of only part of the screen.
Inputs
Both subroutines require the DC of the destination for the image - e.g. Form1.hDC Picture1.hDC
In addition, the PartialScreenShot subroutine needs the Top, Left, Width, Height parameters which define an area of the screen to take a screenshot of.
Assumes
The API call which takes the screenshot is BitBlt. This takes the image on one object and puts it on another object, using the objects' DCs to uniquely identify each object. The other two API calls are used to get the DC of the entire screen. The DC of the object that you are putting the image on can be found from its .hDC property (if it has one).
Code Returns
None, but puts an image on the object which has its hDC passed to one of the subroutines.
Side Effects
None! (afaik)
Download modTakeScreenShot (3 KB)