ehjoe
Messages postés728Date d'inscriptionsamedi 4 avril 2009StatutMembreDernière intervention30 mars 2014
-
14 mars 2007 à 20:22
PCPT
Messages postés13272Date d'inscriptionlundi 13 décembre 2004StatutMembreDernière intervention 3 février 2018
-
14 mars 2007 à 22:39
Bonjour,
J'ai trouvé un exemple concernant la lecture d'une webcam, par contre je me demande, dans la mesure où la webcam est évidemment sensée tourner en permanence, est-ce que mettre l'image dans le presse-papiers est réellement sérieux ???
Voici le code:
Private Declare Function SetWindowPos Lib "User32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, _
ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
'
Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" ( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hwndParent As Long, _
ByVal nID As Long) As Long
'
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As Any) As Long
'
Private Declare Sub ReleaseCapture Lib "User32" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
'
Const WM_USER As Long = &H400
Const WM_CAP_DRIVER_CONNECT As Long = WM_USER + 10
Const WM_CAP_DRIVER_DISCONNECT As Long = WM_USER + 11
Const WM_CAP_GRAB_FRAME As Long = WM_USER + 60
Const WM_CAP_EDIT_COPY As Long = WM_USER + 30
Const Flags = &H2 Or &H1 Or &H40 Or &H10
'
Dim iResult As Long
Dim Resultat As Long
'
Sub Form_Load() ' lancement
iResult = capCreateCaptureWindow("Capture", 0, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Me.hwnd, 0)
SendMessage iResult, WM_CAP_DRIVER_CONNECT, 0, 0
End Sub
Sub Timer1_Timer() ' balayage image
Clipboard.Clear
SendMessage iResult, WM_CAP_GRAB_FRAME, 0, 0
SendMessage iResult, WM_CAP_EDIT_COPY, 0, 0
Picture1.Picture = Clipboard.GetData
End Sub