Solved

Question about webcam

Posted on 2002-03-10
4
1,842 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

733 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