Capture desktop/Screen shot, and save to file, easiest way using only one API call!! A must see!
This will take a screen shot using only one API call, no bitblt and other complicated routines. This is simple and works. This code will simulate a keypress (the snap shot button), then will copy the data to clipboard (like if you had pressed the Snap shot button on your keyboard) and save it to file. Vote for me or gimme' some feedback if you think this is cool.
Original Author: $mTp
Code
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _ Public Function Capture_Desktop(ByVal Destination$) as Boolean '****Declares
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
On Error goto errl
DoEvents
Call keybd_event(vbKeySnapshot, 1, 0, 0) 'Get the screen and copy it to clipboard
DoEvents 'let computer catch up
SavePicture Clipboard.GetData(vbCFBitmap), Destination$ ' saves the clipboard data to a BMP file
Capture_Desktop = True
Exit Function
errl:
Msgbox "Error number: " & err.number & ". " & err.description
Capture_Desktop = False
End Function
'A lil' example
Private Sub Command1_Click()
Capture_Desktop "c:windowsdesktopdesktop.bmp" 'That's it
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.