Urgent capture ecran!!

pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 - 16 juin 2003 à 15:05
cs_raff Messages postés 182 Date d'inscription dimanche 18 août 2002 Statut Membre Dernière intervention 5 janvier 2004 - 16 juin 2003 à 17:50
slt

je cherche un moyen de faire une capture ecran sans que le cpu soit saturé. En effet j utilise :
Call keybd_event(vbKeySnapshot, 1, 0&, 0&) 'on lance virtuellement l'appuie sur la touche Impr écran Syst

mais ca bloque le pc le temps de la capture

Je part en vacances et j essaye de faire un soft qui capturera l image lorsque le pc sera ouvet qd je serai pas la !!!!

Lol je part demain!! alors si qq a un ex????

1 réponse

cs_raff Messages postés 182 Date d'inscription dimanche 18 août 2002 Statut Membre Dernière intervention 5 janvier 2004 3
16 juin 2003 à 17:50
voilà la méthode pour faire une capture d'écran....ça ne passe pas par le clipboard, ça ne fait qu'aller chercher le device du desktop, puis ça fait un transfert de bits dans un picturebox (ou sur une form, enfin, sur n'importe quoi qui possède un dc)...

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Private Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
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 LongPrivate Const SRCCOPY &HCC0020 ' (DWORD) dest source
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Dim num As Integer
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
Private Sub Picture1_DblClick()
End
End Sub
Private Sub Form_load()
Picture1.Cls
CopyDesktop Picture1
Picture1.Refresh
End Sub
0
Rejoignez-nous