USB Webcam liefert schwarzes Bild
Verfasst: 14.11.2014 17:31
Hi, habe eine Webcam am PC angeschlossen und will per Klick ein Foto machen (natürlich mit vorhergehender Vorschau) ich bekomme aber nur ein schwarzes Bild. Gibt's da evtl eine andere Möglichkeit für PB um eine WebCam zu kontrollieren ? Mein Code ist folgender :
Funktioniert nur unter PB 3.9.ö... aber nur blackScreen... ich brauche nix kompliziert großes.... 
Code: Alles auswählen
#WM_CAP_START = #WM_USER
#WM_CAP_DRIVER_CONNECT = #WM_CAP_START + 10
#WM_CAP_DRIVER_DISCONNECT = #WM_CAP_START + 11
#WM_CAP_DRIVER_GET_CAPS = #WM_CAP_START + 14
#WM_CAP_SET_PREVIEW = #WM_CAP_START + 50
#WM_CAP_SET_PREVIEWRATE = #WM_CAP_START + 52
#WM_CAP_STOP = #WM_CAP_START + 68
If OpenWindow(0, 0, 0, 340, 260, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, "Video capture")
If OpenLibrary(0, "C:\WINDOWS\system32\avicap32.dll")
*capAddress = IsFunction(0, "capCreateCaptureWindowA")
hWndC = CallFunctionFast(*capAddress, "My Capture Window", #WS_CHILD | #WS_VISIBLE, 10, 10, 320, 240, WindowID(),1)
SendMessage_(hWndC, #WM_CAP_DRIVER_CONNECT, 0, 0)
SendMessage_(hWndC, #WM_CAP_SET_PREVIEW, #True, 0)
SendMessage_(hWndC, #WM_CAP_SET_PREVIEWRATE, 15, 0)
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
SendMessage_(hWndC, #WM_CAP_STOP, 0, 0)
SendMessage_(hWndC, #WM_CAP_DRIVER_DISCONNECT, 0, 0)
DestroyWindow_(hWndC)
CloseLibrary(0)
End
