Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function CreateDCAsNull Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any, lpInitData As Any) 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
Public Sub CopyDesktop(ByRef objTo As PictureBox)
Dim hwnd As Long
Dim tR As RECT
Dim hDC As Long
hwnd = GetDesktopWindow()
GetWindowRect hwnd, tR
hDC = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)
BitBlt objTo.hDC, 0, 0, (tR.Right - tR.Left), (tR.Bottom - tR.Top), hDC, 0, 0, SRCCOPY
DeleteDC hDC
End Sub
Seul les admins et l'auteur du code lui même peuvent modifier ce code.