Question How to control a webcam in VB

robertb_NZ

Well-known member
Joined
May 11, 2010
Messages
146
Location
Auckland, New Zealand
Programming Experience
10+
I use VS2008 with Visual Basic and VB.Net. I am writing an application to save videos from a webcam, and I've found several examples that provide the basic functionality so that I can start and stop the webcam, and save a video as a .avi file. However my interface is still clunky: when video capture starts following
SendMessage(hWnd, WM_CAP_SEQUENCE, 0, 0)
then the window is locked and the [Stop Capture] button doesn't function, so I need to exit the window to stop capture. The documentation at Video Capture has a lot of methods that look useful, and I think that I need to link up a callback function to allow [Stop Capture] to function, but I can't figure out from this documentation how to send a WM_CAP_SET_CALLBACK_VIDEOSTREAM message to do this.

Is there any general tutorial that will cover all of the messages in AVICAP32.dll, and show me how to implement them in VB?

Thank you,
Robert
 
I managed to figure most of this out from a variety of web pages, I'm still stuck on how to compress the huge .avi files that are being saved. I'd really like some help with this.

In the meantime for anybody who is interested, here is my code as it is today, in case this is helpful to others. Feel free to email me at robert DOT barnes AT xtra DOT co DOT nz* for the latest version, or if you need help understanding it without the front-end form.
* This is supposed to be a simple trick to avoid my email being picked up by spammers.
 

Attachments

  • frmVideo.vb.txt
    13.6 KB · Views: 741
Back
Top