COleDropTarget::Register failed to register CMfcToolBar pointer RRS feed

  • Question

  • I have a problem that is cmfctoolbar is not registered using COleDropTarget::Register(this). why it is failed to register? Please do favour by giving the rite solution.

    And also ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnOzoneDropDown) not working. When I do dropdown on the toolbar button OnOzoneDropDown handler is not getting call. I am using CMFCToolbar.

    class COzDropTarget : public COleDropTarget
        virtual DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD      dwKeyState, CPoint point) ;
        virtual DROPEFFECT OnDragOver ( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point );
        virtual void OnDragLeave( CWnd* pWnd );
        virtual BOOL OnDrop ( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point );
        void SetParentWindow(COZoneBar* pOzBar);

        COZoneBar* m_pOzBar;
    class COZoneBar : public CMFCToolBar
        friend COzDropTarget;
        COzDropTarget m_dropTarget;

    int COZoneBar::CreateBtn()
        if(m_dropTarget.Register(this) == 0)    //registration failed
           AfxMessageBox(_T("Register failed"));  

    Thursday, February 5, 2009 1:16 PM