Hi all,

I have found this screencapture class.
VB Code:
  1. Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, ByVal lpInitData As String) As Integer
  2.  
  3.     Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer
  4.  
  5.     Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
  6.  
  7.     Private Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
  8.  
  9.     Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
  10.  
  11.     Private Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer
  12.  
  13.     Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer
  14.  
  15.     Private Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer
  16.  
  17.     Const SRCCOPY As Integer = &HCC0020
  18.  
  19.  
  20.  
  21.  
  22.     Public Shared Function GetScreen()
  23.         Dim oBackground As Bitmap
  24.         Dim FW, FH As Integer
  25.         Dim hSDC, hMDC As Integer
  26.         Dim hBMP, hBMPOld As Integer
  27.         Dim r As Integer
  28.  
  29.         hSDC = CreateDC("DISPLAY", "", "", "")
  30.         hMDC = CreateCompatibleDC(hSDC)
  31.  
  32.         FW = GetDeviceCaps(hSDC, 8)
  33.         FH = GetDeviceCaps(hSDC, 10)
  34.  
  35.         hBMP = CreateCompatibleBitmap(hSDC, FW, FH)
  36.  
  37.         hBMPOld = SelectObject(hMDC, hBMP)
  38.         r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, 13369376)
  39.         hBMP = SelectObject(hMDC, hBMPOld)
  40.  
  41.         r = DeleteDC(hSDC)
  42.         r = DeleteDC(hMDC)
  43.  
  44.         oBackground = Image.FromHbitmap(New IntPtr(hBMP))
  45.         DeleteObject(hBMP)
  46.         Return oBackground
  47.     End Function
But when I use it, it only makes an screenshot of my background how can I let it make a screenshot of an program that I am running instead?

Already thanks,

Smurf