C# web cam WM_CAP_CONNECT: Want to force a capture source when multiple capture sources present.

Posted by Codejoy on Stack Overflow See other posts from Stack Overflow or by Codejoy
Published on 2010-05-17T08:44:08Z Indexed on 2010/05/17 8:51 UTC
Read the original article Hit count: 930

Filed under:
|
|

I am using WebCam_Capture code I found online to access through C# a web cam. On a computer with one video source it works like a charm! (Program starts up at start up, finds the webcam and it works).

Though on a computer with many video sources (Say a web cam and then manycam running on top of that), the program starts and queries the user which source to use. I would love my program to start up autonomously at the restart of a machine so this waiting for user input throws a wrench in that, anyway I can force it to just select say the first found source and go with that?

So i have some webcam code I yes indeed found online here:

http://channel9.msdn.com/forums/TechOff/93476-Programatically-Using-A-Webcam-In-C/?CommentID=94149

and now in preparing this post I did do more research and found out that my issue lies in this line from the above code:

SendMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0);

That is what connects the webcam up, the only issue is that the above brings up this annoying video source dialog if I have more than one source. I want it to just use the first source so that dialog doesn't come up. I tried passing in different values where the 0's are, sure enough the dialog doesn't come up but it doesn't work either. Anyone know if there is a value I can pass to the SendMessage to suspend the dialog and yet have it select the first video source it finds?

© Stack Overflow or respective owner

Related posts about c#

Related posts about webcam