VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Screen Capture Module 1.0. Includes a function for capturing the entire screen and dumping it onto

by Jonathan Liu (9 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 7th February 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Screen Capture Module 1.0. Includes a function for capturing the entire screen and dumping it onto an compatible object with a hDC property.

API Declarations


'by Buttress Root Software
'
'Programmed by Jonathan Liu
'Copyright ©1999-2371 Buttress Root Software. All rights reserved.

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020

Rate Screen Capture Module 1.0. Includes a function for capturing the entire screen and dumping it onto



Function CaptureScreen(ByVal sngSourceX As Single, ByVal sngSourceY As Single, _
    ByVal sngDestinationX As Single, ByVal sngDestinationY As Single, _
    objObject As Object) As Long
On Error GoTo ErrHandler
Dim lngReturn As Long
Dim lngObjectHandle As Long
Dim lngDesktopWindow As Long
Dim lngDesktopDC As Long
Dim sngScreenHeight As Single
Dim sngScreenWidth As Single

lngObjectHandle = objObject.hdc
sngScreenHeight = Screen.Height / Screen.TwipsPerPixelY
sngScreenWidth = Screen.Width / Screen.TwipsPerPixelX
lngDesktopWindow = GetDesktopWindow()
lngDesktopDC = GetDC(lngDesktopWindow)
CaptureScreen = BitBlt(lngObjectHandle, sngDestinationX, sngDestinationY, _
    sngScreenWidth, sngScreenHeight, lngDesktopDC, sngSourceX, sngSourceY, _
    &HCC0020)
lngReturn = ReleaseDC(lngObjectHandle, lngDesktopDC)
objObject.Refresh
ErrHandler: Exit Function
End Function


Download this snippet    Add to My Saved Code

Screen Capture Module 1.0. Includes a function for capturing the entire screen and dumping it onto Comments

No comments have been posted about Screen Capture Module 1.0. Includes a function for capturing the entire screen and dumping it onto . Why not be the first to post a comment about Screen Capture Module 1.0. Includes a function for capturing the entire screen and dumping it onto .

Post your comment

Subject:
Message:
0/1000 characters