本帖最后由 goodnew 于 2011-07-25 13:14:09 编辑

解决方案 »

  1.   

    http://xjchilli.blog.163.com/blog/static/45347739200881910743949/
    因为 COleControl 不直接支持 ON_MOUSEWHEEL 事件,但 COleControl 是从 CWnd 派生出来的,而 CWnd 是支持这一事件的,因此考虑在应用程序主类(CXXXCtrl)中直接使用 CWnd 类的消息函数。
      

  2.   

    窗口基类CWnd在MFC类结构中的核心地位,ATL中没有这个类,我该这么办?我的控件是基于CComControl的
      

  3.   

    窗口基类CWnd在MFC类结构中的核心地位,ATL中没有这个类,我该这么办?我的控件是基于CComControl的
      

  4.   

    看了,我没有用MFC,这个方法不可行。
      

  5.   

    如果是这样的话,你试试子类化这个控件,在外部修改它的消息回调函数
    子类化参考下面的
    http://www.vckbase.com/document/viewdoc/?id=1343
      

  6.   

    学习了一下子类化,不过我在一个ATL工程中做的控件,怎么会去外面修改呢?我想让这个控件具有onmousewheel消息,再思考思考我。up up
      

  7.   

    我英文不太好,谁能帮我看看他是怎么解决这个问题的,我跟他的问题一样。http://www.tech-archive.net/Archive/VC/microsoft.public.vc.atl/2004-04/0050.html
    Hi there, 
    I created one ATL control(Composite Control) and let it to receive 
    WM_MouseWheel 
    message. After completing, I found it could not receive WM_MouseWheel 
    message 
    (But any others like WM_LBUTTONDBLCLK are OK). I searched here and 
    found I 
    need do SetFocus() before mousewheel action. It works in ActiveX 
    Control test Container. But when I inserted it in MFC application, it 
    did not work. No 
    response for mouse whel action. Following is some segments of my 
    code: 
    1. Message handle 
       CHAIN_MSG_MAP(CComCompositeControl<CAVNicePlay>) 
       MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) 
    2. I used LBDown to do SetFocus() 
    LRESULT CAVNicePlay::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM 
    lParam, BOOL& bHandled) 

            SetFocus(); 
            return 0; 

    Is there something wrong? 
    Thanks in advance 
    Alex 
      

  8.   

    你给的那英文的问题还没解决吧,他说调用WM_MOUSEWHEEL前用SetFocus(),但最后说在插入到MFC中时还是有问题
      

  9.   

    原因可能是控件在鼠标滚轮滚动时,获得不了焦点,如果鼠标点击的话,就以获得。MFC中 用SetFocus,atl中不知用什么?也许ATL中 鼠标按钮事件与MFC有很大不同。
      

  10.   

    如果控件(或者其中的子窗口)能够获得焦点,获得焦点的窗口可以收到鼠标滚轮事件
    看一下控件中各个窗口的属性,是否有WS_TAB属性
      

  11.   

    现在我换用基于ATL Control 选择基于Button控件创建组件,在ActiveX test Container 中点击button后可以响应滚轮事件,如果不基于任何控件,或基于静态控件都进不去滚轮滚动事件。