Option Explicit
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 Declare Function GetWindowDC Lib "user32" (ByVal hWnd As Long) As LongPrivate Sub Command1_Click()
BitBlt Picture1.hDC, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, GetWindowDC(0), 0, 0, vbSrcCopy
End Sub

解决方案 »

  1.   

    常量定义:
    Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
    APi函数:
    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点击按钮,屏幕拷贝到Form
    Private Sub Command1_Click()
        ’得到桌面的HDC
        Dim hDeskDC As Long
        hDeskDC = GetWindowDC(GetDesktopWindow())
        ‘件桌面显示到Picture中
        BitBlt Picture.hDC, 0, 0, Screen.Width / Screen.TwipsPerPixelX,    Screen.Height / Screen.TwipsPerPixelY, hDeskDC, 0, 0, SRCCOPY
    End Sub
      

  2.   

    多谢楼上的各位大哥,不过我想再问得详细一点,就是如何使抓得的图片在picturebox框中以picturebox的比例完整的显示,谢谢