如题,求解~~~~~~~谢谢!
网上查查,都没看到解决的方法。对话框创建代码如下,BOOL ret = m_Dlg.Create(IDD_DIALOG_MESS ,CWnd::FromHandle(::GetDesktopWindow()));// CWnd::FromHandle(m_hParent)
if(ret==0)
{
return NULL;
}
::ShowWindow(m_Dlg.m_hWnd,SW_SHOW);

解决方案 »

  1.   

    非模态框不响应PreTranslateMessage,
    与父窗口共享消息,可在父窗口处理
      

  2.   

    非模态响应的PreTranslateMessage
    是在你后面的那个窗口句柄
    楼主的是:CWnd::FromHandle(::GetDesktopWindow())
      

  3.   


    怎么让非模态对话框自己响应PreTranslateMessage()呢???
      

  4.   


    怎么让非模态对话框自己响应PreTranslateMessage()呢???
      

  5.   

    Child风格就在 CChildDlg中响应。
      

  6.   

    // CChildDlg2 message handlersBOOL CChildDlg2::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    afxDump << "ChildDlg2::PreTranslateMessage\n" ; return CDialog::PreTranslateMessage(pMsg);
    }
    //
    ChildDlg2child风格。
      

  7.   

    初始化:
    m_pDlg2=new CChildDlg2;
    m_pDlg2->Create(IDD_DIALOG2,this);
    m_pDlg2->ShowWindow(SW_SHOW);
    rc1.left=rc.Width()/2;
    rc1.right=rc.right;
    rc1.top=0;
    rc1.bottom=rc.bottom;
    m_pDlg2->MoveWindow(&rc1);
      

  8.   

    问题解决,谢谢各位http://wenku.baidu.com/view/5c873a1d6bd97f192279e990.html
      

  9.   

    http://wenku.baidu.com/view/5c873a1d6bd97f192279e990.html
    看到有人是使用Hook方法来做的,真是难找啊,分享给大家LRESULT CALLBACK CMessMangerApp::GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
    {
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
    LPMSG lpMsg = (LPMSG) lParam; if(AfxGetApp()->PreTranslateMessage(lpMsg))
    {
    lpMsg->message = WM_NULL;
    lpMsg->lParam = 0L;
    lpMsg->wParam = 0;
    } // Passes the hook information to the next hook procedure in
    // the current hook chain.
    return ::CallNextHookEx(hHook, nCode, wParam, lParam);
    }BOOL CMessMangerApp::InitInstance() 
    {
    hHook = ::SetWindowsHookEx(
    WH_GETMESSAGE,
    GetMessageProc,
    AfxGetInstanceHandle(),
    GetCurrentThreadId()); ASSERT (hHook);
    return CWinApp::InitInstance();
    }int CMyApp::ExitInstance() 
    {
    UnhookWindowsHookEx((HHOOK)hHook);
    return CWinApp::ExitInstance();
    }
      

  10.   

    回调函数一般都作为全局函数不作为成员函数,GetMessageProc应作为全局函数,不过这种方法也确实也解决了非模态对话框中消息的拦截。