The following code illustrates how to write data to the image capture buffer.
USHORT usUserParm = 0; ULONG ulReturn; BITMAPINFOHEADER2 *pbmphdr; MMOTIONHEADER *pmmothdr; MCI_IMAGE_PARMS mciImageParms; memset (mciImageParms, 0x00, sizeof (MCI_IMAGE_PARMS)); mciImageParms.hwndCallback = hwndNotify; /* If you desire to set from a standard format converted */ /* buffer */ if (ulFlags & MCI_CONVERT) { /******************************/ /* For RGB BITMAP data buffer */ /******************************/ mciImageParms.ulPelFormat = MCI_IMG_RGB; mciImageParms.usBitCount = 24; mciImageParms.ulImageCompression = MCI_IMG_COMP_NONE; mciImageParms.ulPelBufferWidth = 200; mciImageParms.ulPelBufferHeight = 100; mciImageParms.ulBufLen = ((200 * 3) * 100) + sizeof (BITMAPINFOHEADER2); DosAllocMem (&mciImageParms.pPelBuffer, mciImageParms.ulBufLen, PAG_COMMIT | PAG_WRITE | PAG_READ); /* Set the BITMAP HEADER section to look like a real bitmap*/ pbmphdr = (BITMAPINFOHEADER2 *)mciImageParms.pPelBuffer; pbmphdr->cbFix = sizeof (BITMAPINFOHEADER2); pbmphdr->cx = mciImageParms.ulPelBufferWidth; pbmphdr->cy = mciImageParms.ulPelBufferHeight; pbmphdr->cPlanes = 1; pbmphdr->cBitCount = mciImageParms.usBitCount; /* Set the BITMAP DATA section to RGB white. */ memset ((PVOID)((LONG)mciImageParms.pPelBuffer + sizeof (BITMAPINFOHEADER2) ), 0xFF, mciImageParms.ulBufLen - sizeof (BITMAPINFOHEADER2)); } else { /********************************/ /* For M-Motion YUV data buffer */ /********************************/ mciImageParms.ulPelFormat = MCI_IMG_YUV; mciImageParms.usBitCount = 12; mciImageParms.ulImageCompression = MCI_IMG_COMP_NONE; mciImageParms.ulPelBufferWidth = 200; mciImageParms.ulPelBufferHeight = 100; mciImageParms.ulBufLen = (200 * 100) + ((200 * 100) >> 1) + sizeof (MMOTIONHEADER); DosAllocMem (&mciImageParms.pPelBuffer, mciImageParms.ulBufLen, PAG_COMMIT | PAG_WRITE | PAG_READ); /* Set the BITMAP HEADER section to look like a real bitmap */ pmmothdr = (MMOTIONHEADER *)mciImageParms.pPelBuffer; strncpy (&pmmothdr->mmID[0], "YUV12C", 6); pmmothdr->mmXlen = mciImageParms.ulPelBufferWidth ; pmmothdr->mmYlen = mciImageParms.ulPelBufferHeight; /* Leave the yuv buffer black for this example. */ } ulReturn = mciSendCommand(usDeviceID, MCI_SETIMAGEBUFFER, MCI_WAIT | ulFlags, (PVOID)&mciImageParms, usUserParm);