Private Function CaptureWindow(ByVal hWndSrc As Long, _
ByVal bClient As Boolean, ByVal LeftSrc As Long, _
ByVal TopSrc As Long, ByVal WidthSrc As Long, _
ByVal HeightSrc As Long) As Picture
Private Sub command1_Click()
Set Picture1.Picture = CaptureForm(Me)
End Sub
Private Function CaptureForm(frm As Form) As Picture
With frm
Set CaptureForm = CaptureWindow(.hWnd, False, 0, 0, _
.ScaleX(.Width, vbTwips, vbPixels), _
.ScaleY(.Height, vbTwips, vbPixels))
End With
End Function
Private Function CaptureWindow(ByVal hWndSrc As Long, _
ByVal bClient As Boolean, ByVal LeftSrc As Long, _
ByVal TopSrc As Long, ByVal WidthSrc As Long, _
ByVal HeightSrc As Long) As Picture
Private Sub command1_Click()
Set Picture1.Picture = CaptureForm(Me)
End Sub
Private Function CaptureForm(frm As Form) As Picture
With frm
Set CaptureForm = CaptureWindow(.hWnd, False, 0, 0, _
.ScaleX(.Width, vbTwips, vbPixels), _
.ScaleY(.Height, vbTwips, vbPixels))
End With
End Function
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