Use the function: What is does is copy the Form's DC to a PictureBox, then we save it by calling the SavePicture function.
Make sure that the PictureBox (in the pBox argument) is invisible.
VB Code:
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
Sub SaveScreen(vFrm As Form, pBox As PictureBox, sFileName As String)
Dim iWidth As Integer, iHeight As Integer
pBox.Visible = False
pBox.AutoRedraw = True
vFrm.AutoRedraw = False
pBox.Move 0, 0, vFrm.ScaleWidth, vFrm.ScaleHeight
iHeight = vFrm.ScaleHeight / Screen.TwipsPerPixelY
iWidth = vFrm.ScaleWidth / Screen.TwipsPerPixelX
BitBlt pBox.hDC, 0, 0, iWidth, iHeight, vFrm.hDC, 0, 0, vbSrcCopy
SavePicture pBox.Image, sFileName
End Sub
And you would call it like:
VB Code:
SaveScreen Form1, Picture1, "C:\MyFile.bmp"