Solved

Question about webcam

Posted on 2002-03-10
4
1,838 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now