The capGetVideoFormatSize macro retrieves the size required for the video format. You can use this macro or explicitly call the WM_CAP_GET_VIDEOFORMAT message.
DWORD capGetVideoFormatSize(
hwnd
);
Returns the size, in bytes, of the video format or zero if the capture window is not connected to a capture driver. For video formats that require a palette, the current palette is also returned.
Because compressed video formats vary in size requirements applications must first retrieve the size, then allocate memory, and finally request the video format data.
Video Capture Overview, Video Capture Macros, WM_CAP_GET_VIDEOFORMAT