You can dynamically connect or disconnect a capture window to a capture driver. You can connect or associate a capture window with a capture driver by using the WM_CAP_DRIVER_CONNECT message (or the capDriverConnect macro). After a capture window and capture driver are connected, you can send device-specific messages to the capture driver associated with a capture window.
If you have more than one capture device installed on a system, you can connect a capture window to a particular video capture device driver by specifying an integer for the wParam parameter of the WM_CAP_DRIVER_CONNECT message. The integer is an index that identifies a video capture driver listed in the registry or in the [drivers] section of the SYSTEM.INI file. Use zero for the first index entry.
You can retrieve the name and version of an installed capture driver by using the the capGetDriverDescription function. Your application can use this function to enumerate the installed capture devices and drivers, so the user can select a capture device to connect to a capture window.
You can retrieve the name of the capture device driver connected to a capture window by using the WM_CAP_DRIVER_GET_NAME message (or the capDriverGetName macro). To retrieve the version of an installed capture driver, use the WM_CAP_DRIVER_GET_VERSION message (or the capDriverGetVersion macro).
You can disconnect a capture window from a capture driver by using the WM_CAP_DRIVER_DISCONNECT message (or the capDriverDisconnect macro).
When an capture window is destroyed, any connected video capture device drivers are automatically disconnected.