显示VFW设备对话框
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:
- Stop the filter graph.
- Query the capture filter for the IAMVfwCaptureDialogs interface. If QueryInterface succeeds, it means the capture device is a VFW device.
- Call IAMVfwCaptureDialogs::HasDialog to check if the driver supports the dialog box that you wish to display. TheVfwCaptureDialogs 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 SUCCEEDEDmacro.
- If the dialog box is supported, call IAMVfwCaptureDialogs::ShowDialog to display the dialog box.
- 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();
摘自:http://msdn.microsoft.com/en-us/library/windows/desktop/dd375484(v=vs.85).aspx