Advertisement
7_2009-2012 Miscellaneous #226465

Take Screenshot From VB

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.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
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
Original Comments (3)
Recovered from Wayback Machine