Share via


Windows Media Player 11 SDK The OnPaint Method 

Windows Media Player SDK banner art

Previous Next

The OnPaint Method

The OnPaint method is called whenever the plug-in window should paint itself. This occurs when the plug-in window receives a WM_PAINT message, which is mapped to the OnPaint method in the message map described earlier. The wizard provides an implementation of this method that paints the background black and places the name of the plug-in in the plug-in window. The only modification that is necessary for the Search UI plug-in is the removal of the code that displays the text.

The following code is used to implement this method:

LRESULT OnPaint(UINT nMsg, WPARAM wParam, 
                         LPARAM lParam, BOOL& bHandled)
{
    PAINTSTRUCT ps;

    HDC hDC = BeginPaint(&ps);

    RECT rc;
    GetClientRect(&rc);

    HBRUSH hNewBrush = ::CreateSolidBrush( RGB(0, 0, 0) );

    if (hNewBrush)
    {
        ::FillRect(hDC, &rc, hNewBrush );
        ::DeleteObject( hNewBrush );
    }

    EndPaint(&ps);
    return 0;
}

See Also

Previous Next