Please use FireFox to view this page

This website has been designed for use with the FireFox browser. Please use FireFox to view this page.

PublicConst
WM_CAP_DRIVER_CONNECT AsInteger = WM_USER + 10

PublicConst
WM_CAP_DRIVER_DISCONNECT AsInteger = WM_USER + 11

PublicConst
WM_CAP_SET_VIDEOFORMAT AsInteger = WM_USER + 45

PublicConst
WM_CAP_SET_PREVIEW AsInteger
= WM_USER + 50

PublicConst WM_CAP_SET_PREVIEWRATE AsInteger = WM_USER + 52

The video format is defined in terms of a bitmap, so we must
define our standard bitmap structure

PublicStructure BITMAPINFOHEADER

Dim
biSize AsInteger

Dim
biWidth AsInteger

Dim
biHeight AsInteger

Dim
biPlanes AsShort

Dim
biBitCount AsShort

Dim
biCompression AsInteger

Dim
biSizeImage AsInteger

Dim
biXPelsPerMeter AsInteger

Dim
biYPelsPerMeter AsInteger

Dim
biClrUsed AsInteger

Dim
biClrImportant AsInteger

EndStructure

PublicStructure BITMAPINFO

Dim
bmiHeader As BITMAPINFOHEADER

Dim bmiColors() AsInteger

EndStructure

Now we start getting down-and-dirty into the API, these
calls are where the real magic happens. The first three API calls,
SetWindowPos, SendMessage, and SendMessageAsBitmap (usually called
SendMessageAsAny) are standard windows API calls, and are usually used to
position application windows, and send windows messages to them. In our case
the application window, is in fact a webcam capture window, and responds to a
special set of windows messages.

The capCreateCaptureWindow and capGetDriverDescription are
from the Video For Windows API. The former API function is used to create a new
webcam capture window, and map a VFW driver to it. The latter API function is
used to enumerate VFW devices, such as Webcams on the system.