C # WM_CAP_CONNECT webcam: want to force a capture source if there are multiple capture sources

I am using the WebCam_Capture code that I found online to access through the C # webcam. On a computer with a single video source, it works like a charm! (The program starts at startup, finds a webcam and works).

Although on a computer with many video sources (say, a webcam, and then repeated work on it), the program starts and asks the user which source to use. I would really like my program to start autonomously when the machine reboots, so this wait for user input causes a key in this, anyway I can make it just select the first source found and go with it?

So, I have a webcam code that I really found here:

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

and now, in preparing this post, I did more research and found out that my problem is this line from the above code:

SendMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0);

This is what connects the webcam up, the only problem is that the above causes this annoying video source dialog if I have multiple sources. I want him to simply use the first source so that dialogue does not occur. I tried to pass different values, where 0, of course, the dialogue does not occur, but it does not work either. Does anyone know if there is a value that I can pass to SendMessage to pause the dialog, and yet you have a choice of the first video source found?

+2
1

, , , 0 :

SendMessage(_windowHandle, WM_CAP_CONNECT, _videoSourceIndex, 0)

0,1,2, . , 5 , - . .

DirectShow.NET, , API, .

+1

All Articles