Solutions to capDriverConnect () connection failure in Win7

Source: Internet
Author: User

I recently studied audio and video processing programming. The first problem I encountered was that the capDriverConnect function always fails to capture the video source. A capture source dialog box is displayed, after I click "OK", the return value of the function is 0, and the capture fails. I also searched the internet for this information and found that many people encountered this problem, we all said that it would take many connections to succeed. The number of connections is uncertain. It is just luck. If you are lucky, you can connect them. However, no solution is provided, after many experiments, I found a solution to this problem.

I checked the books on VC ++ video processing, and the connection code provided in it is all in the following form:

If (capDriverConnect (m_hwnd, 0) = TRUE)

{

...... // Indicates that the connection is successful and other code can be executed.

}

Else

{

MessageBox ("connection failed ");

Return false;

}

In this case, I found that the same problem we encountered was that we could not connect to the video driver. Later I thought that since multiple connections may be able to be connected, I would like to put it in the While loop to see how the situation works.

I changed the program.

While (capDriverConnect (m_hwnd, 0 )! = TRUE)

Continue;

I found that only one capture source dialog box is displayed, and you can connect to it after clicking OK. So if anyone encounters this problem, we suggest you replace if with While

The specific reason is unknown.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.