Usare WebCam in Visual Basic
Regole del forum
Ricorda di indicare chiaramente nell'oggetto il linguaggio ([C#] oppure [PHP], [Java], [HTML], ...), se la discussione ne riguarda uno in particolare!
- KillerPenguin
- Livello: DVD-ROM (5/15)
- Messaggi: 111
- Iscritto il: mar mag 07, 2013 12:30 am
- Contatta:
Usare WebCam in Visual Basic
-
- Livello: Workstation (10/15)
- Messaggi: 1364
- Iscritto il: mer mag 01, 2013 1:35 pm
- Località: Villorba (TV)
Re: Usare WebCam in Visual Basic
http://www.dotnethell.it/articles/WebcamCapture.aspx
Premetto che non ho mai provato, ma è sicuramente interessante un tuo feedback a riguardo.
Stiamo tornando...
- KillerPenguin
- Livello: DVD-ROM (5/15)
- Messaggi: 111
- Iscritto il: mar mag 07, 2013 12:30 am
- Contatta:
Re: Usare WebCam in Visual Basic
ho copiato queste righe di codice in questo modo:Andy94 ha scritto:Nel link a seguire trovi delle indicazioni interessanti per fare ciò che ti serve.
http://www.dotnethell.it/articles/WebcamCapture.aspx
Premetto che non ho mai provato, ma è sicuramente interessante un tuo feedback a riguardo.
Codice: Seleziona tutto
Public Class Form1
Public Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, ByVal cbVer As Integer) As Boolean
Public Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
(ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
ByVal nHeight As Short, ByVal hWndParent As Integer, _
ByVal nID As Integer) As Integer
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
ByVal lParam As Object) As Integer
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Integer, _
ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, _
ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
'Handle della finestra di preview
Dim hHwnd As Integer
'Dico alla dll di dirigere il flusso alla mia finestra di preview
hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, _
480, objPreview.Handle.ToInt32, 0)
SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0)
'Imposto la preview
SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
'imposto il rate in millisecondi
SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
'Faccio partire la preview
SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
'Scalo la preview all'interno della dimensione del mio box immagine
SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, iWidth, iHeight, SWP_NOMOVE Or SWP_NOZORDER)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strName As String = Space(100)
Dim strVer As String = Space(100)
Dim bReturn As Boolean
Dim x As Integer = 0
'carica la lista completa nell'elenco
Do
'ricava il nome del driver e la versione
bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
'se un device lo aggiunge alla lista
If bReturn Then lstDevices.Items.Add(strName.Trim)
x += 1
Loop Until bReturn = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
End Sub
End Class
inoltre non ho capito dove specificare il nome della PictureBox dove dovrà comparire l'immagine della webcam ho sbagliato a scrivere il codice?
- KillerPenguin
- Livello: DVD-ROM (5/15)
- Messaggi: 111
- Iscritto il: mar mag 07, 2013 12:30 am
- Contatta:
Re: R: Usare WebCam in Visual Basic
http://www.relay70.org/using-aforge-net ... -to-webcam
-
- Argomenti simili
- Risposte
- Visite
- Ultimo messaggio