Function capDriverConnect(ByVal lwnd As Long, ByVal i As Integer) As Boolean
'Verbinder ein Aufnahmefenster zum Aufnahmetreiber
capDriverConnect = SendMessage(lwnd, WM_CAP_DRIVER_CONNECT, i, 0)
End Function
Function capDriverGetCaps(ByVal lwnd As Long, ByVal s As Long, ByVal wSize As _
Integer) As Boolean
'Gibt die Verfügbarkeit der Videohardware an
capDriverGetCaps = SendMessage(lwnd, WM_CAP_DRIVER_GET_CAPS, wSize, s)
End Function
Function capGetStatus(ByVal lwnd As Long, ByVal s As Long, ByVal wSize As _
Integer) As Boolean
'Status des Videofensters bekommen
capGetStatus = SendMessage(lwnd, WM_CAP_GET_STATUS, wSize, s)
End Function
Function capDlgVideoFormat(ByVal lwnd As Long) As Boolean
'"Format" Dialog der Videoquelle anzeigen
capDlgVideoFormat = SendMessage(lwnd, WM_CAP_DLG_VIDEOFORMAT, 0, 0)
End Function
Function capDlgVideoSource(ByVal lwnd As Long) As Boolean
'"Quelle" Dialog des Videoeingangs anzeigen
capDlgVideoSource = SendMessage(lwnd, WM_CAP_DLG_VIDEOSOURCE, 0, 0)
End Function
Function capDlgVideoDisplay(ByVal lwnd As Long) As Boolean
'"Options"Dialog anzeigen (Helligkeit, Kontrast, etc)
capDlgVideoDisplay = SendMessage(lwnd, WM_CAP_DLG_VIDEODISPLAY, 0, 0)
End Function
Function capPreview(ByVal lwnd As Long, ByVal f As Boolean) As Boolean
'Video Stream starten
capPreview = SendMessage(lwnd, WM_CAP_SET_PREVIEW, f, 0)
End Function
Function capPreviewRate(ByVal lwnd As Long, ByVal wMS As Integer) As Boolean
'Vorschau Rate (Schnelligkeit der neuen Bilder) feststellen
capPreviewRate = SendMessage(lwnd, WM_CAP_SET_PREVIEWRATE, wMS, 0)
End Function
Function capSetCallbackOnError(ByVal lwnd As Long, ByVal lpProc As Long) As _
Boolean
'wird bei einem AVICap Fehler aufgerufen
capSetCallbackOnError = SendMessage(lwnd, WM_CAP_SET_CALLBACK_ERROR, 0, _
lpProc)
End Function
Function capSetCallbackOnStatus(ByVal lwnd As Long, ByVal lpProc As Long) As _
Boolean
'wird bei einer Statusveränderung des Anzeigefensters aufgerufen
capSetCallbackOnStatus = SendMessage(lwnd, WM_CAP_SET_CALLBACK_STATUS, 0, _
lpProc)
End Function
Function capSetCallbackOnYield(ByVal lwnd As Long, ByVal lpProc As Long) As _
Boolean
'wird aufgerufen, wenn ein Fehler während der Aufnahme auftritt
capSetCallbackOnYield = SendMessage(lwnd, WM_CAP_SET_CALLBACK_YIELD, 0, _
lpProc)
End Function
Function capSetCallbackOnFrame(ByVal lwnd As Long, ByVal lpProc As Long) As _
Boolean
'wird aufgerufen, die Bilder anzuzeigen
capSetCallbackOnFrame = SendMessage(lwnd, WM_CAP_SET_CALLBACK_FRAME, 0, _
lpProc)
End Function
Function capSetCallbackOnVideoStream(ByVal lwnd As Long, ByVal lpProc As Long) _
As Boolean
'wird aufgerufen, wenn der Videobuffer voll ist
capSetCallbackOnVideoStream = SendMessage(lwnd, _
WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, lpProc)
End Function
Function capSetCallbackOnWaveStream(ByVal lwnd As Long, ByVal lpProc As Long) _
As Boolean
'wird aufgerufen, wenn ein neuer Audio Buffer verfügbar ist
capSetCallbackOnWaveStream = SendMessage(lwnd, _
WM_CAP_SET_CALLBACK_WAVESTREAM, 0, lpProc)
End Function
Function capSetCallbackOnCapControl(ByVal lwnd As Long, ByVal lpProc As Long) _
As Boolean
'Aufnahme-Steuerungs Makro
capSetCallbackOnCapControl = SendMessage(lwnd, _
WM_CAP_SET_CALLBACK_CAPCONTROL, 0, lpProc)
End Function Danach kannst du die Webcam wit folgendem Aufruf Startklar machen und eine Vorschau erzeugen(auf Form1):
Dim lpszName As String * 100
Dim lpszVer As String * 100
Dim Caps As CAPDRIVERCAPS
' Capture Fenster erzeugen
capGetDriverDescriptionA 0, lpszName, 0, lpszVer, 0 ' Treiber Informationen
' ermitteln
lwndC = capCreateCaptureWindowA(lpszName, WS_CHILD Or WS_VISIBLE, 0, 0, _
hoehevorschaufenster, weitevorschaufenster, form1.hwnd, 0)
' Das Capture Fenster mit dem Treiber verbinden
capDriverConnect lwndC, 0
' Die Kapazitäten des Treibers ermitteln
capDriverGetCaps lwndC, VarPtr(Caps), Len(Caps)
capPreviewRate lwndC, 100
capPreview lwndC, True Und jetzt kommt das was ich meinte. Um das Programm wieder zu beenden musst du die folgenden aufrufe tätigen, damit das Programm ein zweites MAl richtig aufgerufen wird.
' Alle Callback Funktionen deaktivieren
capSetCallbackOnError lwndC, vbNull
capSetCallbackOnStatus lwndC, vbNull
capSetCallbackOnYield lwndC, vbNull
capSetCallbackOnFrame lwndC, vbNull
capSetCallbackOnVideoStream lwndC, vbNull
capSetCallbackOnWaveStream lwndC, vbNull
capSetCallbackOnCapControl lwndC, vbNull Gibt aber auch irgendwo einen Link. Such mal in Google. Wenn ich es nochmal sehe poste ich den Link hier rein. |