Solved

Question about webcam

Posted on 2002-03-10
4
1,841 Views
Last Modified: 2008-02-01
I made a control that connects to the webcam.
The problem is that when trying to connect to the webcam if the webcam is already in use a screen comes up asking the user to select a different webcam device.

I am using this function to call the connect to the webcam device:

function capDriverConnect(ByVal hCapWnd as Long, Optional ByVal i as long = 0&) as Boolean
    capDriverConnect = SendMessageAsLong(hCapWnd, WM_CAP_DRIVER_CONNECT, i, 0&)
end function

So, basically what I want is a function to check if the specified web cam is in use or not; or else a function that tries to connect to the web device and if it is in use it will just not connect rather then prompt the user with a screen to select another device.
0
Comment
Question by:Joshyy
  • 2
4 Comments
 
LVL 2

Expert Comment

by:PeteD
ID: 6854607
ping
0
 
LVL 1

Expert Comment

by:Smokintbird
ID: 6857237
Try this, it's got most of the code you're looking for...
it's more complicated than you're asking for, but it's also quite complete...

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=28493&lngWId=1

let me know if this suits your needs...
0
 
LVL 1

Author Comment

by:Joshyy
ID: 6861790
sorry Smokintbird... but I already made a web cam device ... the problem is that if the webcam device is already in use (by another program) when you start "your" program a screen comes up asking you to select a different web cam... it is this that i want to stop from happening.
0
 
LVL 1

Accepted Solution

by:
Smokintbird earned 100 total points
ID: 6862983
first off, the function you're using is calling "WM_CAP_DRIVER_CONNECT"...
the code you should be looking at, is the value of "WM_CAP_START" at the time it attempts to connect.
set a breakpoint after it gets that variable, and find out it's value when the device is in use and when it's not...

then simply put an if-then statement in to trap for the used state...
if used, then bail out or pop a message box or something...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question