Share via


Windows Media Player 11 SDK The OnCreate Method 

Windows Media Player SDK banner art

Previous Next

The OnCreate Method

The OnCreate method is called when the plug-in window is first created.

The following code is used to implement this method:

LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    HWND hCtrl = ::CreateWindowEx(0L, _T("BUTTON"), _T("Search"),
        WS_CHILD | BS_PUSHBUTTON, 10, 10, 100, 30, m_hWnd, 
        (HMENU)IDC_SEARCH, _Module.GetResourceInstance(), NULL);
    ::ShowWindow(hCtrl, SW_SHOW );
    return 0;
}

This method creates the Search button and associates it with the IDC_SEARCH command ID, which is defined at the beginning of the file:

#define IDC_SEARCH 2000

This command ID is mapped to the OnSearch method in the message map section described previously.

See Also

Previous Next