Hallo Leute
Ich will im Windows 8 meine Webcam ansteuern unter Windows 7 geht das ja ohne Problem aber unter Windows 8 sehe ich das die Kamera sich einschaltet aber das Bild bleibt Schwarz was kann ich machen das sie auch dort geht?
DANKE
Const WM_CAP As Short = &H400S
Const WM_CAP_DRIVER_CONNECT As Integer = WM_CAP + 10
Const WM_CAP_DRIVER_DISCONNECT As Integer = WM_CAP + 11
Const WM_CAP_EDIT_COPY As Integer = WM_CAP + 30
Const WM_CAP_SET_PREVIEW As Integer = WM_CAP + 50
Const WM_CAP_SET_PREVIEWRATE As Integer = WM_CAP + 52
Const WM_CAP_SET_SCALE As Integer = WM_CAP + 53
Const WS_CHILD As Integer = &H40000000
Const WS_VISIBLE As Integer = &H10000000
Const SWP_NOMOVE As Short = &H2S
Const SWP_NOSIZE As Short = 1
Const SWP_NOZORDER As Short = &H4S
Const HWND_BOTTOM As Short = 1
Dim hHwnd As Integer
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
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
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
Integer, ByVal wMsg As Integer, ByVal wParam As Integer, <MarshalAs( _
UnmanagedType.AsAny)> ByVal lParam As Object) As Integer
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
Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean
Private Sub OpenPreviewWindow(Optional ByVal PicHeight As Integer = 350, _
Optional ByVal PicWidth As Integer = 350)
hHwnd = capCreateCaptureWindowA(0, WS_VISIBLE Or WS_CHILD, 0, 0, 640, 480, _
picCapture.Handle.ToInt32, 0)
If CBool(SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, 0, 0)) Then
SendMessage(hHwnd, WM_CAP_SET_SCALE, CInt(True), 0)
SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
SendMessage(hHwnd, WM_CAP_SET_PREVIEW, CInt(True), 0)
SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, PicWidth, PicHeight, _
SWP_NOMOVE Or SWP_NOZORDER)
Else
DestroyWindow(hHwnd)
End If
End Sub |