예제 #1
0
HRESULT CWmp_scrobbler::SetCore(IWMPCore *pCore)
{
    HRESULT hr = S_OK;

    // release any existing WMP core interfaces
    ReleaseCore();

    // If we get passed a NULL core, this  means
    // that the plugin is being shutdown.

    if (pCore == NULL)
    {
        return S_OK;
    }

    m_spCore = pCore;

    // connect up the event interface
    CComPtr<IConnectionPointContainer>  spConnectionContainer;

    hr = m_spCore->QueryInterface( &spConnectionContainer );

    if (SUCCEEDED(hr))
    {
        hr = spConnectionContainer->FindConnectionPoint( __uuidof(IWMPEvents), &m_spConnectionPoint );
    }

    if (SUCCEEDED(hr))
    {
        hr = m_spConnectionPoint->Advise( GetUnknown(), &m_dwAdviseCookie );

        if ((FAILED(hr)) || (0 == m_dwAdviseCookie))
        {
            m_spConnectionPoint = NULL;
        }
    }

    m_wmpBootStrap.setParentHwnd( FindWindow( "WMPlayerApp", "Windows Media Player" ) );
    char filename[512];

	// Get the DLL filename etc
	GetModuleFileName( _Module.GetModuleInstance(), filename, sizeof( filename ) );
	CStdString Temp = filename;
	int pos = Temp.ReverseFind('\\');
	
	StartScrobbling( Temp.Left( pos + 1 ), _Module.GetModuleInstance() );
    
    if( m_wmpBootStrap.bootStrapRequired() )
    {
        m_wmpBootStrap.setCore( m_spCore );
        m_wmpBootStrap.setScrobSub( &m_Submitter );
        m_wmpBootStrap.setModuleHandle( _Module.GetModuleInstance() );
        m_wmpBootStrap.startBootStrap();
    }

    return hr;
}
예제 #2
0
//////////////////////////////////////////////////////////////////////////////
// C[!output Safe_root]::SetCore
// Set WMP core interface
//////////////////////////////////////////////////////////////////////////////
STDMETHODIMP C[!output Safe_root]::SetCore(IWMPCore * pCore)
{
    HRESULT hr = S_OK;

    // release any existing WMP core interfaces
    ReleaseCore();

    // If we get passed a NULL core, this  means
    // that the plugin is being shutdown.

    if (pCore == NULL)
    {
        return S_OK;
    }

    m_spCore = pCore;

    [!if LISTENTOEVENTS]
    // connect up the event interface
    CComPtr<IConnectionPointContainer>  spConnectionContainer;

    hr = m_spCore->QueryInterface( &spConnectionContainer );

    if (SUCCEEDED(hr))
    {
        hr = spConnectionContainer->FindConnectionPoint( __uuidof(IWMPEvents), &m_spConnectionPoint );
    }

    if (SUCCEEDED(hr))
    {
        hr = m_spConnectionPoint->Advise( GetUnknown(), &m_dwAdviseCookie );

        if ((FAILED(hr)) || (0 == m_dwAdviseCookie))
        {
            m_spConnectionPoint = NULL;
        }
    }

    [!endif]
    return hr;
}
예제 #3
0
void CWmp_scrobbler::FinalRelease()
{		
	StopScrobbling();
    ReleaseCore();
}
예제 #4
0
void C[!output Safe_root]::FinalRelease()
{
    ReleaseCore();
}