start a new project and add a commandbutton and a picturebox
then add this code to the form:
VB Code:
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Dim DC As Long
Dim iWidth As Single
Dim iHeight As Single
Dim iFromX As Single
Dim iFromY As Single
Private Sub Command1_Click()
iWidth = Picture1.ScaleWidth
iHeight = Picture1.ScaleHeight
iFromX = 200
iFromY = 200
DC = GetWindowDC(GetDesktopWindow)
BitBlt Picture1.hDC, 0, 0, iWidth, iHeight, DC, iFromX, iFromY, vbSrcCopy
Picture1.Refresh
End Sub
Private Sub Form_Load()
Picture1.ScaleMode = 3
Picture1.AutoRedraw = True
End Sub