HP 500 Slate Built-in Webcams not accessible via capCreateCaptureWindowA (558 Views)
Occasional Visitor
Posts: 1
Registered: ‎10-18-2004
Message 1 of 2 (558 Views)

HP 500 Slate Built-in Webcams not accessible via capCreateCaptureWindowA

I can attach a USB webcam (Logitech 9000) and can programmatically open the camera and record video, take pictures, etc.  Same code fails when trying to connect to the built-in cameras.  Cameras work fine using the provided HP Slate Camera software, but not from a custom app.  Here is relevant code:


    Private Sub LoadDeviceList()

        Dim strName As String = Space(100)
        Dim strVer As String = Space(100)
        Dim bReturn As Boolean
        Dim x As Integer = 0

        'Load name of all avialable devices into the cboDevices
            'Get driver name and version
            bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)

            'If there is a device add device name to the list
            If bReturn Then cboDevices.Items.Add(strName.Trim)

            x += 1
        Loop Until x > 9

    End Sub


Private Sub OpenPreviewWindow()

            Dim iHeight As Integer = picCapture.Height
            Dim iWidth As Integer = picCapture.Width

            iDevice = cboDevices.SelectedIndex

            'Open Preview window in picturebox
            hHwnd = capCreateCaptureWindowA(iDevice.ToString, WS_VISIBLE Or WS_CHILD, 0, 0, 640, 480, picCapture.Handle.ToInt32, 0)

            'Connect to device
            If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
                'Set the preview scale
                SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)

                'Set the preview rate in milliseconds
                SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)

                'Start previewing the image from the camera
                SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)

                'Resize window to fit in picturebox
                SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, picCapture.Width, picCapture.Height, SWP_NOMOVE Or SWP_NOZORDER)
                'Error connecting to device close window
            End If

    End Sub


The following line always returns 0:  SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) when trying to use the built-in camera.  One suggestion that was tried and failed was to retry multiple times.  No luck... fails every time.  Another suggestion that was tried and failed was to interate through iDevice values from 0 to 9.  No luck.


Has anyone overcome this issue or at least have an explanation?

Frequent Advisor
Posts: 47
Registered: ‎01-22-2012
Message 2 of 2 (551 Views)

Re: HP 500 Slate Built-in Webcams not accessible via capCreateCaptureWindowA

Do you know if the built-in camera is UVC (USB Video device Class) compliant? Does it work in other software e.g. Skype? Newest drivers? Tried the built in Windows driver instead of the HP driver?

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.