hey leute,
das ist mein erster Post und ich hoffe das ich das richtige Unterverzeichnis getroffen habe.
Nun zu meinem Problem: Ich benutze die 2 im betreff genannten .dll's um durch meine Webcam ein bild auf der Picturebox zu zeichnen, ich code/schreibe in Visual Basic 2010, das funktioniert soweit so gut, jedoch weiß ich nicht wie das bild abspeichern kann, da naja die Pciturebox eig. leer
im internet vieles probiert aber alles hat nix gefunkt, vllt. hat/hatte jemand ein ähnliches problem
meine codes(fertige codes):
form1 / Kamera auswählen:
Imports DirectX.Capture
Public Class AddCam
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button1.Click
Dim IdVentana As String
If ComboBox1.SelectedItem = Nothing Then
MsgBox("Select an available camera.", MsgBoxStyle.Exclamation, _
"Error")
Exit Sub
End If
CaptureInformation.Camera = Dispositivos.VideoInputDevices( _
ComboBox1.SelectedIndex) ' kamera auswählen
CaptureInformation.CaptureInfo = New Capture(CaptureInformation.Camera, _
Nothing)
MW.Show()
End Sub
Private Sub AddCam_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Dim j As Short
Dim f As Filter
ComboBox1.Items.Clear()
For j = 0 To Dispositivos.VideoInputDevices.Count - 1 ' verfügbare
' kameras auflisten
f = Dispositivos.VideoInputDevices(j)
ComboBox1.Items.Add(f.Name)
Next
ComboBox1.SelectedIndex = 0
End Sub
End Class form2(bild auf picturebox zeichen, nach kamera auswahl)
Imports System.Runtime.InteropServices
Imports DirectX.Capture
Public Class MW
Private Sub MW_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Dim AddCamera As New AddCam()
CaptureInformation.CaptureInfo.PreviewWindow = Me.PictureBox1 'bild
' zeichnen
CaptureInformation.Counter = 1
CaptureInformation.CounterFrames = 1
End Sub
<StructLayout(LayoutKind.Sequential)>
Public Structure POINTAPI
Public x As Integer
Public y As Integer
End Structure
<DllImport("user32.dll")> _
Public Shared Function ClientToScreen(ByVal hWnd As IntPtr, ByRef pt As _
POINTAPI) As Integer
End Function
End Class und noch eine Klasse (capture.vb)
Option Strict Off
Option Explicit On
Imports DirectX.Capture
Imports System
Imports System.IO
Module ModCap
Public Structure Active
Dim Camera As Filter
Dim CaptureInfo As Capture
Dim Counter As Integer
Dim CounterFrames As Integer
Dim PathVideo As String
End Structure
Public CaptureInformation As Active
Public Dispositivos As New Filters()
End Module ich hoffe ihr könnt mir helfen, ich verzweifel langsam. |