by Angsuman Banerji (23 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 18th April 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Screen Capture Module
On Error GoTo ErrorHandler
'Check if the file Exists
If Dir(myFile) <> "" Then Exit Function
'capture the complete screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)
'To get the Active Window
'Call keybd_event(vbKeySnapshot, 0, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), myFile
CaptureScreen = True
Exit Function
ErrorHandler:
MsgBox "Error Occured " & Err.Description
End Function
Private Sub Command1_Click()
Call CaptureScreen("c:\screencap.bmp")
End Sub