A capture window can provide the capture-control callback function with precise control over the moments that streaming capture begin and end. The first message sent from the capture driver to the callback procedure sets the nState parameter to CONTROLCALLBACK_PREROLL after allocating all buffers and all other capture preparations are complete. This message gives the application the ability to preroll the video sources. (The callback function specifies nState as its second parameter.) The callback function then returns at the exact moment recording is to begin. A return value of TRUE from the callback function continues capture. A return value of FALSE aborts capture. Once capture begins, the callback function is called frequently with nState set to CONTROLCALLBACK_CAPTURING to allow the application to end capture by returning false.