Try this code. Rest of the things remain intact.
___
Option Explicit
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As Any) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDC 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
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Command1_Click()
SavePicture CaptureImage(hwnd), "C:\image.bmp"
End Sub
Function CaptureImage(hwnd As Long) As Picture
Dim hDC As Long, R1 As RECT, R2 As RECT
GetWindowRect hwnd, R1
R2 = R1
hDC = GetWindowDC(hwnd)
Picture1.Cls
Picture1.Move 0, 0, ScaleWidth, ScaleHeight
ScreenToClient hwnd, R2
BitBlt Picture1.hDC, 0, 0, R1.Right - R1.Left, R1.Bottom - R1.Top, hDC, -R2.Left, -R2.Top, vbSrcCopy
ReleaseDC hwnd, hDC
Set CaptureImage = Picture1.Image
End Function