m_pListView->Create(NULL,NULL,WS_CHILD | WS_VISIBLE,rect,this,ID_LISTVIEW,pContext);

解决方案 »

  1.   

    主窗口根本就不可能自动给子窗口发消息。你必须映射这些消息,并调用SentMessage()将消息发给子窗口。
      

  2.   

    可是m_pListView->subclassWindow(this->m_hWndMDIClient);
    为什么不行呢? 
      

  3.   

    SubclassWindow函数的作用是让系统将本来发给窗口预定义消息处理函数的消息先发给你从该窗口派生的类的消息处理函数。这和该窗口的父窗口没有任何关系。
      

  4.   


    你看见了吗?
    使用SubclassWindow的指针,根本就不能不是有效的指针:
    相当于你用一个事物去创建自己!
    肯定不行的!
    参考;Call this member function to "dynamically subclass" a window and attach it to this CWnd object. When a window is dynamically subclassed, windows messages will route through the CWnd’s message map and call message handlers in the CWnd’s class first. Messages that are passed to the base class will be passed to the default message handler in the window.
      

  5.   

    to dingsg:
    "使用SubclassWindow的指针,根本就不能不是有效的指针."
    应为“根本就不能是有效的指针”吧to leer:
    "SubclassWindow函数的作用是让系统将本来发给窗口预定义消息处理函数的消息先发给你从该窗口派生的类的消息处理函数。这和该窗口的父窗口没有任何关系。"
    SubclassWindow()不仅仅可以处理从该窗口派生的类吧,还应可以处理其他的与窗口不相关的(
    比如一个控件)类吧:( , 不知为什么,我的263信箱收不到csdn的mail,只好登上来look了。
       
      

  6.   

    to dingsg:
    "使用SubclassWindow的指针,根本就不能不是有效的指针."
    应为“根本就不能是有效的指针”吧to leer:
    "SubclassWindow函数的作用是让系统将本来发给窗口预定义消息处理函数的消息先发给你从该窗口派生的类的消息处理函数。这和该窗口的父窗口没有任何关系。"
    SubclassWindow()不仅仅可以处理从该窗口派生的类吧,还应可以处理其他的与窗口不相关的(
    比如一个控件)类吧:( , 不知为什么,我的263信箱收不到csdn的mail,只好登上来look了。