VB Code:
  1. Public Function GetScreenCapture( _
  2.    Optional ByVal FullScreen As Boolean = False) As Image
  3.  
  4.    ' Captures the current screen and returns as an Image
  5.    ' object
  6.  
  7.    Dim objSK As SendKeys
  8.  
  9.    Dim imgCapture As Image
  10.  
  11.    If FullScreen = True Then
  12.  
  13.        ' Print Screen pressed twice here as some systems
  14.  
  15.        ' grab active window "accidentally" on first run
  16.  
  17.        objSK.SendWait("{PRTSC 2}")
  18.  
  19.    Else
  20.  
  21.        objSK.SendWait("%{PRTSC}")
  22.  
  23.    End If
  24.  
  25.    Dim objData As IDataObject = Clipboard.GetDataObject()
  26.  
  27.    Return objData.GetData(DataFormats.Bitmap)
  28.  
  29. End Function