⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpcontainer.cpp

📁 media player 控件源码 用EVC编译可以进行对WINCE下media player控制
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// Desc: This function returns S_FALSE because the container does not accept
//       any accelerator keys.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::TranslateAccelerator(LPMSG, DWORD)
{
    return S_FALSE;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnFocus()
// Desc: This function returns S_OK because it is supposed to return S_OK in
//       all cases.  From the container's point of view, the control always
//       has focus.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnFocus(BOOL)
{
    return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::ShowPropertyFrame()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::ShowPropertyFrame()
{
    return E_NOTIMPL;
}

//////
// IOleWindow

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::GetWindow()
// Desc: This function returns a handle to the window containing the control.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::GetWindow(HWND *phWnd)
{
    if (NULL == m_hWnd)
    {
        return S_FALSE;
    }
    
    *phWnd = m_hWnd;
    
    return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::ContextSensitiveHelp()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::ContextSensitiveHelp(BOOL)
{
    return E_NOTIMPL;
}

//////
// IOleInPlaceUIWindow Methods

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::GetBorder()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::GetBorder(LPRECT)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::RequestBorderSpace()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::RequestBorderSpace(LPCBORDERWIDTHS)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::SetBorderSpace()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::SetBorderSpace(LPCBORDERWIDTHS)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::SetActiveObject()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::SetActiveObject(IOleInPlaceActiveObject *, LPCOLESTR)
{
    return E_NOTIMPL;
}

//////
// IOleInPlaceFrame Methods

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::InsertMenus()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::InsertMenus(HMENU, LPOLEMENUGROUPWIDTHS)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::SetMenu()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::SetMenu(HMENU, HOLEMENU, HWND)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::RemoveMenus()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::RemoveMenus(HMENU)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::SetStatusText()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::SetStatusText(LPCOLESTR)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::EnableModeless()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::EnableModeless(BOOL)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::TranslateAccelerator()
// Desc: This function always returns false because the container does not
//       have any accelerator keys.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::TranslateAccelerator(LPMSG, WORD)
{
    return S_FALSE;
}

//////
// IOleInPlaceSite Methods

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::CanInPlaceActivate()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::CanInPlaceActivate()
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnInPlaceActivate()
// Desc: This function tells the control what area it has available for
//       activation.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnInPlaceActivate()
{
    HRESULT hr = E_FAIL;
    
    if (NULL != m_pIPOW)
    {
        hr = m_pIPOW->SetObjectRects(&m_rcPos, &m_rcPos);
    }
    else if (NULL != m_pIPO)
    {
        hr = m_pIPO->SetObjectRects(&m_rcPos, &m_rcPos);
    }
    
    return hr;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnUIActivate()
// Desc: This function returns S_OK because it allows for in-place activation.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnUIActivate()
{
    return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::GetWindowContext()
// Desc: This function allows the control to position the parent window where
//       the in-place activation window should be placed.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::GetWindowContext(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
    if (NULL == ppFrame || NULL == ppDoc)
    {
        return E_INVALIDARG;
    }
    
    *ppFrame = this;
    //   AddRef();
    
    *ppDoc = NULL;
    
    CopyRect(lprcPosRect, &m_rcPos);
    CopyRect(lprcClipRect, &m_rcPos);
    
    lpFrameInfo->cb            = sizeof (OLEINPLACEFRAMEINFO);
    lpFrameInfo->fMDIApp       = FALSE;
    lpFrameInfo->hwndFrame     = m_hWnd;
    lpFrameInfo->haccel        = 0;
    lpFrameInfo->cAccelEntries = 0;
    
    return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::Scroll()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::Scroll(SIZE scrollExtent)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnUIDeactivate()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnUIDeactivate(BOOL)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnInPlaceDeactivate()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnInPlaceDeactivate()
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::DiscardUndoState()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::DiscardUndoState()
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::DeactivateAndUndo()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::DeactivateAndUndo()
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnPosRectChange()
// Desc: This function allows the control to reposition and resize the window
//       which it is contained by.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnPosRectChange(LPCRECT lprcPosRect)
{
    RECT rcClient, rcPos;
    long lNewClientWidth, lNewClientHeight;
    HRESULT hr = E_FAIL;
    
    GetClientRect(m_hWnd, &rcClient);
    GetWindowRect(m_hWnd, &rcPos);
    
    // See how much to change the size of the window
    lNewClientWidth  = lprcPosRect->right - lprcPosRect->left;
    lNewClientHeight = lprcPosRect->bottom - lprcPosRect->top;
    
    rcPos.bottom += (lNewClientHeight - rcClient.bottom);
    rcPos.right  += (lNewClientWidth  - rcClient.right);
    
    MoveWindow(m_hWnd,
        rcPos.left,
        rcPos.top,
        rcPos.right - rcPos.left,
        rcPos.bottom - rcPos.top, TRUE);
    
    // Store the new value for the window size
    GetClientRect(m_hWnd, &m_rcPos);
    
    // Have these settings take effect
    if (NULL != m_pIPOW)
    {
        hr = m_pIPOW->SetObjectRects(&m_rcPos, &m_rcPos);
    }
    else if (NULL != m_pIPO)
    {
        hr = m_pIPO->SetObjectRects(&m_rcPos, &m_rcPos);
    }
    
    return hr;
}

//////
// IOleInPlaceSiteEx Methods

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnInPlaceActivateEx()
// Desc: This function is synonymous with OnInPlaceActivate().
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnInPlaceActivateEx(BOOL *, DWORD)
{
    return OnInPlaceActivate();
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::OnInPlaceDeactivateEx()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::OnInPlaceDeactivateEx(BOOL)
{
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::RequestUIActivate()
// Desc: Not implemented.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::RequestUIActivate()
{
    return E_NOTIMPL;
}

//////
// IOleInPlaceSiteWindowless Methods

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::CanWindowlessActivate()
// Desc: This function returns S_OK to indicate that it can in-place activate.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::CanWindowlessActivate()
{
    return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::GetCapture()
// Desc: This function returns S_OK if the window containing the control
//       currently has the mouse capture.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::GetCapture()
{
    HWND    hWnd;
    HRESULT hResult = S_FALSE;
    
    hWnd = ::GetCapture();
    
    if (m_hWnd == hWnd)
    {
        hResult = S_OK;
    }
    
    return hResult;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::SetCapture()
// Desc: This function sets mouse capture to the current window or releases
//       it depending on fCapture.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::SetCapture(BOOL fCapture)
{
    if (fCapture)
    {
        ::SetCapture(m_hWnd);
    }
    else
    {
        ::ReleaseCapture();
    }
    
    return S_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::GetFocus()
// Desc: This function returns S_OK if the window containing the control has
//       focus.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::GetFocus()
{
    HWND    hWnd;
    HRESULT hResult = S_FALSE;
    
    hWnd = ::GetFocus();
    
    if (m_hWnd == hWnd)
    {
        hResult = S_OK;
    }
    
    return hResult;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::SetFocus()
// Desc: This function acquires or releases focus depending on the state of
//       fFocus.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::SetFocus(BOOL fFocus)
{
    if (FALSE != fFocus)
    {
        ::SetFocus(m_hWnd);
    }
    else
    {
        ::SetFocus(NULL);
    }
    
    return E_NOTIMPL;
}

///////////////////////////////////////////////////////////////////////////////
// Name: CMPContainer::GetDC()
// Desc: This function gets the current device context.  This function is
//       required to allow the control to update the tracker bar and status
//       bar.
///////////////////////////////////////////////////////////////////////////////
HRESULT CMPContainer::GetDC(LPCRECT, DWORD, HDC *phDC)
{
    *phDC = ::GetDC(m_hWnd);
    
    return S_OK;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -