Video for Windows Single-Frame Capture Class Without MFC | CodeGuru

Video for Windows Single-Frame Capture Class Without MFC

This is a thoroughly trimmed-down version of Ken Varn’s Video For Windows wrapper class (CVFWImageProcessor). I was creating a Macromedia Director Xtra that gets a live image and processes it. I needed to grab the image without using MFC because, to the best of my knowledge, MFC and MOA (Macromedia Open Architecture) are not compatible. […]

Written By
CodeGuru Staff
CodeGuru Staff
Feb 12, 2004
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

This is a thoroughly trimmed-down version of Ken Varn’s Video For Windows wrapper class (CVFWImageProcessor). I was creating a Macromedia Director Xtra that gets a live image and processes it. I needed to grab the image without using MFC because, to the best of my knowledge, MFC and MOA (Macromedia Open Architecture) are not compatible. Briefly, here’s what I did in case someone wants to do it themselves.

  1. I replaced all MFC data types with ordinary C/C++ or Win32 data types where I could.
  2. I got rid of multithreading altogether because converting MFC threads to Win32 threads looked like it was going to be a major headache.
  3. I removed the MFC #includes.
  4. Finally, I took out everything else I didn’t need, such as the functions for dialogs and for streaming to a file.

    Oh, and it doesn’t seem right to call the class CVFWImageProcessor any more since it doesn’t do much processing, so I call it CVFWCapture.

The demo project includes VFWCaptureTest.cpp, which shows you how to use the CVFWCapture class. You call the CaptureDIB method exactly as shown in Ken’s article.

// Sample source on implemented CVFWCapture class
// to capture a single DIB frame to memory.
CVFWCapture cap;
PBITMAPINFO pBitmap;
ULONG BitmapSize;
cap.Initialize();    // Intialize first found VFW device.
pBitmap = NULL;      // CaptureDIB will automatically
                     // allocate this if it is set to NULL.
// Capture an image from the capture device.
if (cap.CaptureDIB(&pBitmap, 0, &BitmapSize))
{
  // pBitmap captured successfully. Do whatever with it.
  delete pBitmap;    // Delete it when done.
}
cap.Destroy();       // Done using VFW object.
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.