Prendre une capture d'ecran


Propriétés du code


Date de création : 22/01/2007 à 19:39:00
0 Commentaire(s)
  ratala

 

Présentation


Code tout simple qui permet comme son nom l'indique de faire une capture d'ecran. Note : la souris n'est pas visible sur la capture.

 

Code


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


 
 

Modifier le code

Seul les admins et l'auteur du code lui même peuvent modifier ce code.

 

Commentaires


Ajouter un commentaire


Vous devez être connecté pour pouvoir poster un commentaire.

 
 

Valid HTML 4.01 Transitional Valid CSS

Site web de Vb System Library version 1.3
Developpement et design réalisé par : Matthieu Napoli (MadMatt)
© 2007 Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
Temps d'execution de la page : 0.020 s
www.mnapoli.fr