WebCam Bild

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von fraju.

    Hallo Commi. :)
    Ich Programmiere derzeit ein
    Steuerungs Programm, für das Video
    ist eine einfache webCam drinne aber
    wie kann ich die an Steuern?
    den Code den ich bisher habe ist der:

    VB.NET-Quellcode

    1. Public Class Form1
    2. Dim videoHandle1 As IntPtr
    3. Declare Auto Function SendMessage Lib "user32" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    4. Declare Auto Function capCreateCaptureWindow Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Integer, ByVal x As Short, ByVal y As Integer, ByVal nWidth As Short, ByVal nHeight As Short, ByVal hWndParent As IntPtr, ByVal nID As Byte) As IntPtr
    5. Const EM_LINEFROMCHAR As Integer = &HC9
    6. Const EM_LINEINDEX As Integer = &HBB
    7. Const WS_CHILD As Integer = &H40000000
    8. Const WS_VISIBLE As Integer = &H10000000
    9. Const WM_USER As Short = &H400S
    10. Const WM_CAP_START As Short = &H400S
    11. Const WM_CAP_EDIT_COPY As Short = WM_CAP_START + 30
    12. Const WM_CAP_DRIVER_CONNECT As Short = WM_CAP_START + 10
    13. Const WM_CAP_SET_PREVIEWRATE As Short = WM_CAP_START + 52
    14. Const WM_CAP_SET_OVERLAY As Short = WM_CAP_START + 51
    15. Const WM_CAP_SET_PREVIEW As Short = WM_CAP_START + 50
    16. Const WM_CAP_DRIVER_DISCONNECT As Short = WM_CAP_START + 11
    17. Function CreateCaptureWindow(ByRef hWndParent As IntPtr, Optional ByRef x As Short = 0, Optional ByRef y As Short = 0, Optional ByRef nWidth As Short = 530, Optional ByRef nHeight As Short = 360, Optional ByRef nCameraID As Integer = 0) As IntPtr
    18. Dim previewHandle As IntPtr
    19. previewHandle = capCreateCaptureWindow("Video", WS_CHILD + WS_VISIBLE, x, y, nWidth, nHeight, hWndParent, 1)
    20. SendMessage(previewHandle, WM_CAP_DRIVER_CONNECT, nCameraID, 0)
    21. SendMessage(previewHandle, WM_CAP_SET_PREVIEWRATE, 30, 0)
    22. SendMessage(previewHandle, WM_CAP_SET_OVERLAY, 1, 0)
    23. SendMessage(previewHandle, WM_CAP_SET_PREVIEW, 1, 0)
    24. Return previewHandle
    25. End Function
    26. Public Function captureWindow(ByRef nCaptureHandle As IntPtr) As System.Drawing.Image
    27. My.Computer.Clipboard.Clear()
    28. SendMessage(nCaptureHandle, WM_CAP_EDIT_COPY, 0, 0)
    29. Return My.Computer.Clipboard.GetImage
    30. End Function
    31. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    32. videoHandle1 = Me.CreateCaptureWindow(PictureBox1.Handle, 0, 0, 530, 360, 0)
    33. End Sub
    34. End Class

    aber es wird nur ein Schwartzes bild angezeigt
    Könnt ihr mir helfen?
    Danke im vorraus :)