// I have successfully runCode:
# Include "stdafx. H"
# Include <dshow. h>
# Include <streams. h>
# Pragma comment (Lib, "ole32.lib ")
# Pragma comment (Lib, "strmiids. lib ")
Void testmp3 (void );
Int winapi winmain (hinstance,
Hinstance hprevinstance,
Lptstr lpcmdline,
Int ncmdshow)
{
// Todo: Place code here.
Testmp3 ();
Return 0;
}
Void testmp3 ()
{
Igraphbuilder * pgraph;
/* Pointer to the filter graph */
Imediacontrol * pmediacontrol;
/* Pointer to the mediacontrol object */
/* Initialize, Program Run it once at startup */
Coinitialize (null );
/*************************************** ***********************************/
/* The following programs call each time they play an MP3 (or other format) file */
/* Create a filter graph manager */
Cocreateinstance (clsid_filtergraph, null, clsctx_inproc, iid_igraphbuilder, (void **) & pgraph );
Pgraph-> QueryInterface (iid_imediacontrol, (void **) & pmediacontrol );
/* Connect to the filter required for playing the specified file */
Pgraph-> renderfile (L "// test.mp3", null );
/* Start playing the specified file */
Pmediacontrol-> Run ();
/* The file is played in an independent thread in DirectShow. Wait here */
MessageBox (null, l "click [OK] To End playing", l "play MP3", mb_ OK );
Pmediacontrol-> stop ();
/* Stop playing */
Pmediacontrol-> release ();
/* Release the object */
Pgraph-> release ();
/*************************************** ***********************************/
/* Call when the program ends */
Couninitialize ();
}