关于MFC中,非模态对话框,消息映射有关问题

关于MFC中,非模态对话框,消息映射问题。
在电影院点座系统中,要模拟多终端,所以用到了非模态,然后问一下,其中一个对话框的座位有所改变后,可不可以用消息映射来传到其它对话框,如果可以的话帮我看看下面代码有一个错误,本人有点小白请详细点,谢谢。。。。
C/C++ code
// Dialog44.cpp : implementation file
//

#include "stdafx.h"
#include "sp.h"
#include "Dialog44.h"
#include "Dialog1.h"
#include "Dialog3.h"
#include <windows.h>


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
MSG msg;
HWND hDialog;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialog44 dialog


CDialog44::CDialog44(CWnd* pParent /*=NULL*/)
    : CDialog(CDialog44::IDD, pParent)
{
    //{{AFX_DATA_INIT(CDialog44)
        // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
}


void CDialog44::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    //{{AFX_DATA_MAP(CDialog44)
        // NOTE: the ClassWizard will add DDX and DDV calls here
    //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialog44, CDialog)
    //{{AFX_MSG_MAP(CDialog44)
    ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
    ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialog44 message handlers

void CDialog44::OnButton1() 
{
    // TODO: Add your control notification handler code here
    CDialog1 *dlg=new CDialog1,*dlg1=new CDialog1,*dlg2=new CDialog1;
    //CDialog44::OnOK();
    dlg->Create(IDD_DIALOG1,NULL);
    dlg->ShowWindow(SW_SHOW);
    dlg1->Create(IDD_DIALOG1,NULL);
    dlg1->ShowWindow(SW_SHOW);
    dlg2->Create(IDD_DIALOG1,NULL);
    dlg2->ShowWindow(SW_SHOW);
    while (GetMessage (&msg, NULL, 0, 0))
{    
if (hDialog != 0 || !IsDialogMessage (hDialog, &msg))    
{    
TranslateMessage (&msg) ;    
DispatchMessage (&msg) ;    
}
}

    
}

void CDialog44::OnButton2() 
{
    // TODO: Add your control notification handler code here
    CDialog3 *dlg=new CDialog3,*dlg1=new CDialog3,*dlg2=new CDialog3;
    //CDialog44::OnOK();
        dlg->Create(IDD_DIALOG3,NULL);
    dlg->ShowWindow(SW_SHOW);
    dlg1->Create(IDD_DIALOG3,NULL);
    dlg1->ShowWindow(SW_SHOW);
    dlg2->Create(IDD_DIALOG3,NULL);
    dlg2->ShowWindow(SW_SHOW);
}
错误在if (hDialog != 0 || !IsDialogMessage (hDialog, &msg))


------解决方案--------------------
可不可以用消息映射来传到其它对话框

可以啊,我一般是自己SendMessage再发一条消息过去。

你自己再写个消息循环有何意义??
------解决方案--------------------
你可以将所有需要接收消息的窗口句柄保存起来,可以保存在App类的成员变量中,作为一个类似全局变量的序列(CArray类可以满足,或者使用CMap用来保存对话框名称与窗口句柄的映射关系,方便查找)。每次需要向一个窗口发送消息时,就从保存好的句柄序列中取得一个HWND,然后使用::SendMessage向这个窗口发送消息。对应的窗口类中需要定义这个消息的响应函数,可以用ON_MESSAGE(MY_MESSAGE, MyFunction)宏来定义。
像LZ这样自己写一个消息循环,是很费劲的,即使上面的错误不发生,程序也会卡死在那个button的消息循环中。
------解决方案--------------------
利用其它窗口的HWND句柄,SendMessage/PostMesasge()不就可以吗?
------解决方案--------------------
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam);
ON_MESSAGE(WM_MYMESSAGE,OnMyMessage)
ON_WM_RBUTTONDOWN()
LRESULT CTestView::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
MessageBox("这是响应自定义消息","信息提示",MB_OK);
return 1;
}

void CTestView::OnRButtonDown(UINT nFlags, CPoint point)
{
char buf[15] = {"信息提示测试1"};
char buf2[15] = {"dsfdsfsdf"};
//char ch[3] = {0};
//strcpy_s_s(ch,buf);
//strcpy_s(ch,buf2);
::SendMessage(AfxGetMainWnd()->m_hWnd,WM_MYMESSAGE,35,(LPARAM)buf);
}

------解决方案--------------------