# Include <VFW. h>
# Pragma comment (Lib, "vfw32 ")
Play AVI audio streams
// Initialization
Hwnd m_haviwnd = mciwndcreate (m_stccarry.getsafehwnd (),
AfxGetInstanceHandle (),
Ws_child | ws_visible | mciwndf_nomenu, m_stravifile); // cstring m_stravifile
// Operation
Mciwndopen (m_haviwnd, (lpctstr) m_stravifile, 0 );
Mciwndplay (m_haviwnd );
Mciwndstop (m_haviwnd );
Mciwnddestroy (m_haviwnd );
//////////////////////////////////////// //////////////////////////////////////// /////////
// Open a file
Pavifile;
Avifileinit ();
Hresult hR = avifileopen (& pavifile, m_stravifile, of_read, null );
// Retrieve AFI Information
Avifileinfo AFI;
Memset (void *) & AFI, 0, sizeof (avifileinfo ));
HR = avifileinfo (pavifile, & AFI, sizeof (avifileinfo ));
// Obtain the ASI information.
Pavistream pvideostream = NULL;
HR = avifilegetstream (pavifile, & pvideostream, streamtypevideo, 0 );
Avistreaminfo ASI;
HR = avistreaminfo (pvideostream, & ASI, sizeof (avistreaminfo ));
// Outputs Information
Cstring strtext;
Strtext. Format ("total frames: % lu", AFI. dwlength );
M_listaviinfo.addstring (strtext );
Strtext. Format ("FPS: % lf", asi. dwrate/(double) asi. dwscale );
M_listaviinfo.addstring (strtext );
Strtext. Format ("stream: % lu", AFI. dwstreams );
M_listaviinfo.addstring (strtext );
Int nwidth = asi. rcframe. Right-asi. rcframe. Left;
Int nheight = asi. rcframe. Bottom-asi. rcframe. Top;
Strtext. Format ("width/height: % d", nwidth, nheight );
M_listaviinfo.addstring (strtext );
Strtext. Format ("encoding: % s", (char *) & asi. fcchandler );
M_listaviinfo.addstring (strtext );
'// Stream-related, file (the preceding generation is also required)
Avistreamrelease (pvideostream );
Avifileexit ();