VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Take Screenshot From VB

by excelblue (Mark Lu) (4 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

This will take a screenshot of the screen from inside VB. It is not mainly for taking screenshots of apps (Alt + PrintScreen or just PrintScreen). This is mainly for stuff like spying, etc. So this will have the same effect as the PrintScreen key. You will be responsible for protecting the clipboard info. Please erase the clipboard before you run this function as then it will take the previous data in the clipboard first, and then work the second time. I tried putting Clipboard.Clear into the sub but then it will not work at all.

API Declarations
Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Rate Take Screenshot From VB

Public Sub GetScreenShot(SetObj As Object)
  On Error Resume Next
  Dim CurrCBData As Variant, CurrCBText As String, CurrPict As String
  keybd_event vbKeySnapshot, 1, 0, 0
  SetObj.Picture = Clipboard.GetData(vbCFBitmap)
  Clipboard.Clear
End Sub

Download this snippet    Add to My Saved Code

Take Screenshot From VB Comments

No comments have been posted about Take Screenshot From VB. Why not be the first to post a comment about Take Screenshot From VB.

Post your comment

Subject:
Message:
0/1000 characters