I've got some code (Winforms, C#, .Net 4) that uses the Directshow.Net library. I've run into a problem 2 times now where a device has a "webcam" but it doesn't show up in Device Manager as an imaging device, but as something else. When that happens the DirectShow.Net either doesn't recognize it, or recognizes it enough to work with it some, but if I try and capture the video it blows up. This most recently happened on a Microsoft Surface Pro 4, running Windows 10. Anyone have any ideas about this? Why is it happening or how to get around it? Hardware interface isn't my specialty and this is my only product code that deals with a direct hardware interface.
Answers can be in VB or C# (or any other language).
Thanks
Edit: I believe the error is happening from this line of code (from the DirectShow.Net library), full function call further down:
hr = m_VidControl.SetMode(m_pinStill, VideoControlFlags.Trigger);
I'm having trouble nailing this down since I don't have access to develop on a device that has a webcam that isn't actually a webcam
The error returned is
System.Runtime.InteropServices.COMException (0x80070032): The request is not supported.
at DirectShowLib.DsError.ThrowExceptionForHR(Int32 hr)
Full function code:
public IntPtr Click()
{
int hr;
// get ready to wait for new image
m_PictureReady.Reset();
m_ipBuffer = Marshal.AllocCoTaskMem(Math.Abs(m_stride) * m_videoHeight);
try
{
m_WantOne = true;
// If we are using a still pin, ask for a picture
if (m_VidControl != null)
{
// Tell the camera to send an image
hr = m_VidControl.SetMode(m_pinStill, VideoControlFlags.Trigger);
DsError.ThrowExceptionForHR(hr);
}
// Start waiting
if (!m_PictureReady.WaitOne(9000, false))
{
throw new Exception("Timeout waiting to get picture");
}
}
catch
{
Marshal.FreeCoTaskMem(m_ipBuffer);
m_ipBuffer = IntPtr.Zero;
throw;
}
// Got one
return m_ipBuffer;
}