一个可编辑的ListCtr控件扩展类,,当检测到最后一行最后一列的时候,,想向主窗体(放ListCtr) 发送一个消息,
以至于给,主窗体(对话框)处理消息。。发现消息只能发给自己,如何才能发送给主窗体??

解决方案 »

  1.   

    要获得主窗口的指针
    试试:GetParent()->SendMessage(...)
    或者 在创建ListCtr控件扩展类的时候把主窗口的指针传递进来。
      

  2.   

    BOOL PostMessage(
      HWND hWnd,      // handle to destination window
      UINT Msg,       // message
      WPARAM wParam,  // first message parameter
      LPARAM lParam   // second message parameter
    );The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message. To post a message in the message queue associate with a thread, use the PostThreadMessage function. 
      

  3.   

    CWnd* pWnd = AfxGetMainWnd();
    if(pWnd)
     pWnd->PostMessage();
      

  4.   

    谢谢楼上 的
    这样发送完全正确能用,CWnd* pWnd = AfxGetMainWnd();
    if(pWnd)
     pWnd->PostMessage();...
    BOOL CExListDlg::PreTranslateMessage(MSG* pMsg)   主要窗体拦截即可
    {
    // TODO: Add your specialized code here and/or call the base class
            switch (pMsg->message)
            {   
            case  WM_USER_EDIT_OVER: