Ok Since I promised your request in the comments, and sorry to keep you waiting, was really busy. I barely managed to publish this answer. But here it is:
I imitate that opencv captures a black image. In the output window, which I asked you in the comments about what it says, shows that there is an error.

After research, I realized that this is due to the available camera format: 
Because it is a more lousier camera. If you have a better camera like logitech, you can see that the format available is much larger. 
There are many methods, you can try something like
capture.set(CV_CAP_PROP_FRAME_WIDTH , 640); capture.set(CV_CAP_PROP_FRAME_HEIGHT , 480); capture.set (CV_CAP_PROP_FOURCC, CV_FOURCC('B', 'G', 'R', '3'));
then the webcam will be able to click. This webcam is a bit wrong, so the image taken is not so pretty. 
Hope this is your problem. but this may not be so. I like debugging problems, but I canโt give up all the possible reasons why this happens to you, since I'm really busy, since you asked for an example, this is one of them. Greetings. If you could tell me what the window error says, I can probably help more.
EDIT (answer your comments in more detail):
Ok, I want you to try a few things:
1) First, instead of using cvQueryFrame or similar capture methods, I want you to try using this webcam to capture video. Wait, maybe say 10 seconds to make sure it is successful. The reason is that some cameras (better ones) take quite a long time to warm up, and the first few frames that they capture may be empty.
2) If the first step does not work, try entering
cout << cv::getBuildInformation() << endl;
and insert results for media input / output and video input / output? I want to see the results. I would also suspect your library dependencies, but since you said that this works with a Logitech camera, I doubt it. Of course, there is always a chance that the camera is not compatible with OpenCV. By the way, does the camera have any brands?
3) Alternatively, just find the usb drivers online and install it, I had a friend who did this for a similar problem, but not sure about it.