CAPCONTROLCALLBACK callback function (vfw.h)

The capControlCallback function is the callback function used for precision control to begin and end streaming capture. The name capControlCallback is a placeholder for the application-supplied function name.

To set the callback, send the WM_CAP_SET_CALLBACK_CAPCONTROL message to the capture window or call the capSetCallbackOnCapControl macro.


CAPCONTROLCALLBACK Capcontrolcallback;

LRESULT Capcontrolcallback(
  HWND hWnd,
  int nState



Handle to the capture window associated with the callback function.


Current state of the capture operation. The CONTROLCALLBACK_PREROLL value is sent initially to enable prerolling of the video sources and to return control to the capture application at the exact moment recording is to begin. The CONTROLCALLBACK_CAPTURING value is sent once per captured frame to indicate that streaming capture is in progress and to enable the application to end capture.

Return value

When nState is set to CONTROLCALLBACK_PREROLL, this callback function must return TRUE to start capture or FALSE to abort it. When nState is set to CONTROLCALLBACK_CAPTURING, this callback function must return TRUE to continue capture or FALSE to end it.


The first message sent to the callback procedure sets the nState parameter to CONTROLCALLBACK_PREROLL after allocating all buffers and all other capture preparations are complete.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header vfw.h

See also

Video Capture

Video Capture Functions