Microsoft DirectX 9.0

Display VFW Capture Dialog Boxes

A capture device that still uses a Video for Windows (VFW) driver can support any of the following three dialog boxes, which are used to configure the device.

Dialog box Description
Video Source Used to select the video input and to adjust device settings, such as picture brightness or contrast.
Video Format Used to select the image dimensions and bit depth.
Video Display Used to control the appearance of the rendered video.

To show one of these dialog boxes, do the following:

  1. Stop the filter graph.
  2. Query the capture filter for the IAMVfwCaptureDialogs interface. If QueryInterface succeeds, it means the capture device is a VFW device.
  3. Call IAMVfwCaptureDialogs::HasDialog to check if the driver supports the dialog box that you wish to display. The VfwCaptureDialogs enumeration defines flags for each of the VFW dialog boxes. HasDialog returns S_OK if the dialog box is supported. It returns S_FALSE otherwise, so check for the value S_OK directly, rather than using the SUCCEEDED macro.
  4. If the dialog box is supported, call IAMVfwCaptureDialogs::ShowDialog to display the dialog box.
  5. Restart the graph.

The following code shows these steps for the Video Source dialog box:

pControl->Stop(); // Stop the graph.

// Query the capture filter for the IAMVfwCaptureDialogs interface.
IAMVfwCaptureDialogs *pVfw = 0;
hr = pCap->QueryInterface(IID_IAMVfwCaptureDialogs, (void**)&pVfw);
if (SUCCEEDED(hr))
{
    // Check if the device supports this dialog box.
    if (S_OK == pVfw->HasDialog(VfwCaptureDialog_Source))
    {
        // Show the dialog box.
        hr = pVfw->ShowDialog(VfwCaptureDialog_Source, hwndParent);
    }
}
pControl->Run();