Visual Studio 2017
.NET 4.5.2
Windows 7

I have written an app that accesses a built-in camera on a tablet computer, when I run the app with administrative rights it all works just fine, when I switch to a user that has only standard user rights - it fails.

This statement fails if I am a Standard User but works if I am an Administrator:
"If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0)"


Here is the piece of code (Sorry - I couldn't figure out how to insert the code in a code box - so here it is copied and pasted)

Private Sub OpenPreviewWindow()
Dim iHeight As Integer = picCapture.Height
Dim iWidth As Integer = picCapture.Width
'
' Open Preview window in picturebox
'
hHwnd = capCreateCaptureWindowA(iDevice, 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)

btnSave.Enabled = True
btnStop.Enabled = True
btnStart.Enabled = False
Else
'
'Error connecting To device close window
'
DestroyWindow(hHwnd)
btnSave.Enabled = False
End If
End Sub


Thank You