An Intelligent MP3 Jukebox
by Mark Nelson


Listing One
m_PlayerHostWindow.Create( m_hWnd, rect, "LouisPlayerHost", WS_CHILD | 
                          WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE );
CComPtr<IAxWinHostWindow> pHost;
HRESULT hr = m_PlayerHostWindow.QueryHost( &pHost );
char *guid = "{6BF52A52-394A-11d3-B153-00C04F79FAA6}";
hr = pHost->CreateControl( CComBSTR(guid), m_PlayerHostWindow, 0);

Listing Two
protected:
    CComPtr<IWMPPlayer> m_Player;
    CComPtr<IWMPPlaylist> m_Playlist;
    CComPtr<IWMPControls> m_Controls;
    CComPtr<IWMPMediaCollection> m_MediaCollection;

Listing Three
hr = m_PlayerHostWindow.QueryControl( &m_Player );
hr = m_Player->get_currentPlaylist( &m_Playlist );
hr = m_Player->get_controls( &m_Controls );
hr = m_Player->get_mediaCollection( &m_MediaCollection );

Listing Four
class CLouisEventSink 
  : public IDispEventImpl<1, CLouisEventSink, &DIID__WMPOCXEvents, &LIBID_WMPOCX, 1, 0 >
{
public:
  CLouisEventSink( CLouisDialog &frame );
  virtual ~CLouisEventSink();
  CLouisDialog &m_Frame;
  BEGIN_SINK_MAP(CLouisEventSink)
    SINK_ENTRY_EX( 1, DIID__WMPOCXEvents, 0x16ae, CurrentItemChange )
  END_SINK_MAP()
    void _stdcall CurrentItemChange(IDispatch * pdispMedia );
};






1


