Share via


Windows Media Player 11 SDK The OnSearch Method 

Windows Media Player SDK banner art

Previous Next

The OnSearch Method

The OnSearch method is called by Windows Media Player when the Search button is clicked. This method retrieves the current Media object and passes it to the LaunchPage method.

The following code is used to implement this method:

LRESULT OnSearch(WORD wNotifyCode, WORD wID, HWND hwndCtl, BOOL& fHandled)
{
    HRESULT hr;
    CComPtr<IWMPMedia> spMedia;

    if( m_pPlugin && m_pPlugin->m_spCore )
    {
        // Get a pointer to the current media item.
        hr = m_pPlugin->m_spCore->get_currentMedia(&spMedia);
        if (SUCCEEDED(hr) && spMedia)
        {
            LaunchPage(spMedia);
        }
    else
        {
            MessageBox(_T("There is no media loaded."), _T("Warn"), MB_OK | MB_ICONWARNING);
        }
    }
    return 0;
}

See Also

Previous Next