如何获得桌面句柄,并通过该句柄抓取该图像(就像ACDSee中抓图抓整个窗口一样),
然后将它保存在D:\temp.jpg,呵。
在线等,呵。
请给出代码?!!

解决方案 »

  1.   

    Option Explicit
    '引用:Microsoft Shell Controls And Automation  在(SHELL32.dll)这个DLL中。
    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 GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Const SRCCOPY = &HCC0020Private Sub Command1_Click()
        Me.AutoRedraw = True
        Dim MyShell As New Shell
        MyShell.MinimizeAll
        Me.WindowState = 1
        Sleep 200
        BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, GetDC(0), 0, 0, SRCCOPY
        Sleep 20
        Me.WindowState = 2
        Me.Refresh
    End Sub
    保存请看:
    http://community.csdn.net/Expert/topic/3209/3209104.xml?temp=.9692652
      

  2.   

    Option Explicit
    '引用:Microsoft Shell Controls And Automation  在(SHELL32.dll)这个DLL中。
    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 GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Const SRCCOPY = &HCC0020Private Sub Form_DblClick()
            Me.BorderStyle = 0
            Me.AutoRedraw = True
            Dim MyShell As New Shell
            MyShell.MinimizeAll
            Me.Hide
            Sleep 200
            BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, GetDC(0), 0, 0, SRCCOPY
            Sleep 20
            Me.Show
            Me.WindowState = 2
            Me.Refresh
    End Sub
    ----------------
    这个会更好一些。Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = 2 Then
            Unload Me
        End If
    End Sub
      

  3.   

    http://blog.csdn.net/lihonggen0/archive/2004/11/13/180394.aspx
      

  4.   


    在VB6和VB.NET中进行图象捕获 VB6中进行图象捕获  '----------------------------------------------------------------------------''Author:lihonggen0'Date:2002-6-19'功能:抓屏'----------------------------------------------------------------------------Private Type POINTAPI    x As Long    y As LongEnd TypePrivate 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 LongPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As LongPrivate Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongPrivate Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As LongPrivate Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long Private Sub Command1_Click()    Dim hdc As Long    Dim sw As Integer    Dim sh As Integer    Dim CurPos As POINTAPI    Dim Cur As Long    Me.Hide    DoEvents    Picture1.AutoRedraw = True    hdc = GetDC(0)    GetCursorPos CurPos    Cur = GetCursor    Picture1.Width = Screen.Width    Picture1.Height = Screen.Height    sw = Screen.Width / Screen.TwipsPerPixelX    sh = Screen.Height / Screen.TwipsPerPixelY    BitBlt Picture1.hdc, 0, 0, sw, sh, hdc, 0, 0, vbSrcCopy    Me.Show    DrawIcon Picture1.hdc, CurPos.x - 10, CurPos.y - 10, Cur    ReleaseDC 0, hdc    Picture1.AutoRedraw = False End Sub'参考'http://support.microsoft.com/?kbid=210108
    http://support.microsoft.com/?id=161299