Quote Originally Posted by .paul. View Post
just press your prtscr button. (read the full thread)
for choices about what to capture, doubleclick the icon in the system tray.
if you just want to incorporate a screen capture into your app, the capturing is done in the clsScreenCapture.vb class
Ok im using this

vb.net Code:
  1. Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  2.  
  3.         Dim image As Bitmap
  4.         Dim fileName As String = ""
  5.         fileName = My.Application.Info.DirectoryPath & "\images\" & Replace(Now.ToString.Replace("/", "-"), ":", ".") & ".png"
  6.         image = CaptureWindow(User32.GetForegroundWindow, Nothing)
  7.         image.Save(fileName, Imaging.ImageFormat.Png)
  8.  
  9.     End Sub
  10.  
  11.     Public Function CaptureWindow(ByVal handle As IntPtr, ByVal r As Rectangle) As Image
  12.         ' get the size
  13.         Dim windowRect As New User32.RECT
  14.  
  15.         Dim width As Integer
  16.         Dim height As Integer
  17.  
  18.         If r = Nothing Then
  19.             User32.GetWindowRect(handle, windowRect)
  20.             'windowRect.left = SplitContainer2.Panel1.Left
  21.             'windowRect.top = SplitContainer2.Panel1.Left
  22.  
  23.             width = windowRect.right - windowRect.left
  24.             height = windowRect.bottom - windowRect.top
  25.         End If
  26.  
  27.         Dim img As Bitmap = New Bitmap(width, height)
  28.         Dim gr As Graphics = Graphics.FromImage(img)
  29.         gr.CopyFromScreen(windowRect.left, windowRect.top, 0, 0, New Size(width, height))
  30.  
  31.         Return img
  32.  
  33.     End Function
  34.     Public Class User32
  35.  
  36.         Public Structure RECT
  37.             Public left As Integer
  38.             Public top As Integer
  39.             Public right As Integer
  40.             Public bottom As Integer
  41.         End Structure 'RECT
  42.         Declare Function GetDesktopWindow Lib "user32.dll" () As IntPtr
  43.  
  44.         Declare Function GetWindowRect Lib "user32.dll" ( _
  45.             ByVal hwnd As IntPtr, _
  46.             ByRef lpRect As RECT) As Int32
  47.  
  48.         Declare Function GetForegroundWindow Lib "user32.dll" _
  49.         Alias "GetForegroundWindow" () As IntPtr
  50.  
  51.     End Class 'User32
  52. End Class

but the problem is that it will take a screenshot of the current active window. How can I change that to take a screen shot of the application and not the curent active window?

Thank you