文章见http://msdn.microsoft.com/msdnmag/issues/01/11/c/
我碰到了与提问者同样的问题,“The problem is that mouse messages go to the control and cannot be overridden in the view.” 但是用Paul DiLascia的方法解决不了问题,所有的鼠标消息都被custom control 截获,view里面根本就触发不了任何鼠标消息,难道是因为我的
custom control 里使用了OnLButtonDown消息?那好,我试着把试着把custom control 里的鼠标消息屏蔽,view里面还是触发不了任何鼠标消息,郁闷中,期望牛人予以解答

解决方案 »

  1.   

    文章里面不是说了custom control要满足一定条件才可以用CCtrlView封装吗?
      

  2.   

    我并没有用CCtrlView封装而是直接用的实例化一个listctrl,形如:Cmylistctrl:m_mylistctrl.然后重载view里的view::oncreate(),形如:m_mylistctrl.create(....);然后view::onsize()使其与client window适应。但是这样的话所有点击view的鼠标事件,比如:onlbuttondown()都被Cmylistctrl控件截获,这也可以理解。但是我怎样才能使view里的onlbuttondown()重新起作用那?不要告诉我重写一个Cmylistvew重载Cmylistctrl里的所有方法,那样也太没有技术含量了。
      

  3.   

    不幸的是你需要转发这样的消息
    参考文章中下面的段落
    if your custom control view class is not a pure wrapper function, that is, if it has so much as one data member or virtual function of its own, then the way to convert your control into a view is to instantiate it as a child window of the view and integrate it in three simple steps.Handle WM_SIZE in the view to position your control exactly over the view's client area.Convert mouse messages in the control to higher-level parent WM_NOTIFY notifications.Handle WM_SETFOCUS in the view to set focus to your control
      

  4.   

    不愧是MVP!我对你的敬仰如滔滔江水....,可是
    “Convert mouse messages in the control to higher-level parent WM_NOTIFY notifications”,就是这句话我看不懂,如果“Convert”是转变的意思,它是指把所有的WM_Command事件用WM_NOTIFY代替,那我都把custom control 里的鼠标消息屏蔽掉了,还是触发不了view的鼠标消息。如果“Convert”是转发的意思,请问蒋老大如何去做?
      

  5.   

    在控件里面捕捉消息之后发WM_NOTIFY到父窗口,也就是View啦
      

  6.   

    回答我最后一个问题,马上给分
                   |
                   |
                   |
    有个人技术网站吗?请问网址?
    你有邮箱吗?我的[email protected]
    你有qq吗?我的:84168964哦,好像不止三个问题了