定义两个CWnd的对象A,B。将其Create()出来,将A与B部分重叠,A在B上面,当点击A与B的重叠部分时,为何是B而不是A响应鼠标点击???
如何让A响应鼠标点击???

解决方案 »

  1.   

    你点击鼠标的时候,产生的消息只能是当前线程的窗口处理。在系统中,每次只能有一个线程和虚拟输入线程“连接”,这个线程的窗口这时就处于激活状态。要想让A窗口响应鼠标消息,你就应该使A窗口激活。可以用SetFocus()啊。
      

  2.   

    用过SetActiveWindow()了,不行啊!
      

  3.   

    不是用SetActiveWindow()。而是用SetFocus()
    (from MSDN)
    The SetFocus member function sends aWM_KILLFOCUS message to the window that loses the input focus and aWM_SETFOCUS message to the window that receives the input focus.
      

  4.   

    可是……可是为什么SetActiveWindow()不管用呢?
      

  5.   

    http://expert.csdn.net/Expert/topic/1365/1365909.xml?temp=.6204645
      

  6.   

    可是……可是为什么SetActiveWindow()不管用呢?
      

  7.   

    The SetActiveWindow function activates a window, but not if the application is in the background. The window will be brought into the foreground (top of Z order) if its application is in the foreground when the system activates the window.