MAGIQUE CAPTURE (CAPTURE D'ÉCRAN ET DE SOUS FENÊTRES)
PierrotVB
Messages postés58Date d'inscriptionvendredi 12 juillet 2002StatutMembreDernière intervention20 août 2004
-
10 janv. 2003 à 12:44
hunter_vb
Messages postés2Date d'inscriptionsamedi 5 mars 2005StatutMembreDernière intervention10 août 2005
-
2 juin 2005 à 20:09
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
hunter_vb
Messages postés2Date d'inscriptionsamedi 5 mars 2005StatutMembreDernière intervention10 août 2005 2 juin 2005 à 20:09
Rien à dire sur ce point, vraiment exellent travail,
vous m'avez sauver Merci
jpb14
Messages postés18Date d'inscriptionjeudi 13 mai 2004StatutMembreDernière intervention22 janvier 2013 1 juin 2004 à 09:46
j'ai sans doute la solution ds ce code à ce que je cherche (envoyer mon image-écran complète ds le Presse papier avec une autre technique que la touche "impr écran"), mais ce sans doute superbe programme manque cruellement de présentation: comment fonctionne t'il, à quoi sert t'il; une fois le prog lancé, que faire de cette jolie flèche bleue ? ... merci à tous ceux qui s'extasient d'un air convaincu de bien vouloir me dire ce qu'ils ont compris ...
cs_PROGRAMMIX
Messages postés1133Date d'inscriptionmercredi 2 octobre 2002StatutMembreDernière intervention24 juillet 20112 6 mai 2004 à 21:09
Je viens de tester la source sans trop regarder au code...
Il me semble qu'il n'est pas possible de capturer un menu déroulé.
Si je me trompe, quel est la procédure à suivre ?
cs_aKheNathOn
Messages postés575Date d'inscriptiondimanche 23 décembre 2001StatutMembreDernière intervention23 octobre 2012 13 janv. 2004 à 21:38
Juste pour simplifier la source, et puis mettre une methode efficace ici, pour qu'on soit pas obligé de télécharger l'exe (qui est super!!... mais c'est un gain de tps)
'API
Private Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32.dll" (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 CreateDC Lib "gdi32.dll" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As DEVMODE) As Long
Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Public Sub CaptureScreen(Left As Long, Top As Long, Width As Long, Height As Long, ByVal dest As Long)
Dim srcDC As Long
srcDC = CreateDC("DISPLAY", "", "", dm)
BitBlt dest, 0, 0, Width, Height, srcDC, Left, Top, SRCCOPY
ReleaseDC dest, srcDC
DeleteDC srcDC
End Sub
Dans un form avec une picturebox
Private Sub Form_Load()
CaptureScreen 0, 0, 100, 100, Picture1.hdc
End Sub
Bréf comme vous le verrez j'ai modifié sa fonction afin de faire une capture écran et ne plus la passer dans le clipboard.
C'est vraiment ça que je cherchais, alors un grand merci :-)
PS : Une fonction existe seulement pour XP pour capturer une fenetre à partir de son handle :
Declare Function PrintWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
· hwnd
Handle to the window that will be copied.
· hdcBlt
Handle to the device context.
· nFlags
Specifies the drawing options. It can be one of the following values.
PW_CLIENTONLY
Only the client area of the window is copied to hdcBlt. By default, the entire window is copied.
Un exemple d'utilisation :
Private Declare Function PrintWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net
Dim mWnd As Long
'launch notepad
Shell "notepad.exe", vbNormalNoFocus
DoEvents
'set the graphics mode to persistent
Me.AutoRedraw = True
'search the handle of the notepad window
mWnd = FindWindow("Notepad", vbNullString)
If mWnd = 0 Then
Me.Print "NotePad window not found!"
Else
'draw the image of the notepad window on our form
PrintWindow mWnd, Me.hDC, 0
End If
End Sub
Bonne prog à tous, et merci d'avoir posté cette source super interessante !
Je la note 10/10 elle déchire de trop ...
PS : Dommage qu'il y ait pas de capture d'écran (c un comble...)
carabidule
Messages postés13Date d'inscriptionsamedi 10 août 2002StatutMembreDernière intervention 7 janvier 2004 17 déc. 2003 à 12:59
Etonnant, Bravo !
cs_zappy
Messages postés161Date d'inscriptionmardi 19 juin 2001StatutMembreDernière intervention10 avril 20072 10 janv. 2003 à 14:00
merci bcp :)
cs_Evil
Messages postés33Date d'inscriptionmercredi 9 octobre 2002StatutMembreDernière intervention 4 novembre 2004 10 janv. 2003 à 13:55
Excellent !! 10/10 !
cs_zappy
Messages postés161Date d'inscriptionmardi 19 juin 2001StatutMembreDernière intervention10 avril 20072 10 janv. 2003 à 12:46
J'ai bourriné un peu le code, prière de me pardonner ;)
PierrotVB
Messages postés58Date d'inscriptionvendredi 12 juillet 2002StatutMembreDernière intervention20 août 2004 10 janv. 2003 à 12:44
2 juin 2005 à 20:09
vous m'avez sauver Merci
1 juin 2004 à 09:46
6 mai 2004 à 21:09
Il me semble qu'il n'est pas possible de capturer un menu déroulé.
Si je me trompe, quel est la procédure à suivre ?
13 janv. 2004 à 21:38
Dans un module mettez ça :
Private Const SRCCOPY &HCC0020 ' (DWORD) destination source
'API
Private Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32.dll" (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 CreateDC Lib "gdi32.dll" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As DEVMODE) As Long
Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Public Sub CaptureScreen(Left As Long, Top As Long, Width As Long, Height As Long, ByVal dest As Long)
Dim srcDC As Long
srcDC = CreateDC("DISPLAY", "", "", dm)
BitBlt dest, 0, 0, Width, Height, srcDC, Left, Top, SRCCOPY
ReleaseDC dest, srcDC
DeleteDC srcDC
End Sub
Dans un form avec une picturebox
Private Sub Form_Load()
CaptureScreen 0, 0, 100, 100, Picture1.hdc
End Sub
Bréf comme vous le verrez j'ai modifié sa fonction afin de faire une capture écran et ne plus la passer dans le clipboard.
C'est vraiment ça que je cherchais, alors un grand merci :-)
PS : Une fonction existe seulement pour XP pour capturer une fenetre à partir de son handle :
Declare Function PrintWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
· hwnd
Handle to the window that will be copied.
· hdcBlt
Handle to the device context.
· nFlags
Specifies the drawing options. It can be one of the following values.
PW_CLIENTONLY
Only the client area of the window is copied to hdcBlt. By default, the entire window is copied.
Un exemple d'utilisation :
Private Declare Function PrintWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim mWnd As Long
'launch notepad
Shell "notepad.exe", vbNormalNoFocus
DoEvents
'set the graphics mode to persistent
Me.AutoRedraw = True
'search the handle of the notepad window
mWnd = FindWindow("Notepad", vbNullString)
If mWnd = 0 Then
Me.Print "NotePad window not found!"
Else
'draw the image of the notepad window on our form
PrintWindow mWnd, Me.hDC, 0
End If
End Sub
Bonne prog à tous, et merci d'avoir posté cette source super interessante !
Je la note 10/10 elle déchire de trop ...
PS : Dommage qu'il y ait pas de capture d'écran (c un comble...)
17 déc. 2003 à 12:59
10 janv. 2003 à 14:00
10 janv. 2003 à 13:55
10 janv. 2003 à 12:46
10 janv. 2003 à 12:44