| 953 | } |
| 954 | |
| 955 | LRESULT CActiveXUI::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled) |
| 956 | { |
| 957 | if( m_pControl == NULL ) return 0; |
| 958 | ASSERT(m_pControl->m_bWindowless); |
| 959 | if( !m_pControl->m_bInPlaceActive ) return 0; |
| 960 | if( m_pControl->m_pInPlaceObject == NULL ) return 0; |
| 961 | if( !IsMouseEnabled() && uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST ) return 0; |
| 962 | bool bWasHandled = true; |
| 963 | if( (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) || uMsg == WM_SETCURSOR ) { |
| 964 | // Mouse message only go when captured or inside rect |
| 965 | DWORD dwHitResult = m_pControl->m_bCaptured ? HITRESULT_HIT : HITRESULT_OUTSIDE; |
| 966 | if( dwHitResult == HITRESULT_OUTSIDE && m_pControl->m_pViewObject != NULL ) { |
| 967 | IViewObjectEx* pViewEx = NULL; |
| 968 | m_pControl->m_pViewObject->QueryInterface(IID_IViewObjectEx, (LPVOID*) &pViewEx); |
| 969 | if( pViewEx != NULL ) { |
| 970 | POINT ptMouse = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; |
| 971 | pViewEx->QueryHitPoint(DVASPECT_CONTENT, &m_rcItem, ptMouse, 0, &dwHitResult); |
| 972 | pViewEx->Release(); |
| 973 | } |
| 974 | } |
| 975 | if( dwHitResult != HITRESULT_HIT ) return 0; |
| 976 | if( uMsg == WM_SETCURSOR ) bWasHandled = false; |
| 977 | } |
| 978 | else if( uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST ) { |
| 979 | // Keyboard messages just go when we have focus |
| 980 | if( !IsFocused() ) return 0; |
| 981 | } |
| 982 | else { |
| 983 | switch( uMsg ) { |
| 984 | case WM_HELP: |
| 985 | case WM_CONTEXTMENU: |
| 986 | bWasHandled = false; |
| 987 | break; |
| 988 | default: |
| 989 | return 0; |
| 990 | } |
| 991 | } |
| 992 | LRESULT lResult = 0; |
| 993 | HRESULT Hr = m_pControl->m_pInPlaceObject->OnWindowMessage(uMsg, wParam, lParam, &lResult); |
| 994 | if( Hr == S_OK ) bHandled = bWasHandled; |
| 995 | return lResult; |
| 996 | } |
| 997 | |
| 998 | bool CActiveXUI::IsDelayCreate() const |
| 999 | { |
no test coverage detected