Re: Why CMainFrame can't accept WM_COPYDATA? by hostran
hostran
Thu Jul 22 22:13:19 CDT 2004
thanks!
I find the key point is :COPYDATASTRUCT!
if you define such as :COPYDATASTRUCT data;
if you give the value data.cbData more than 24488(data.cbData > 24488), you
can't get the message at
"BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) "
Is it VC's bug ? I don't know why?
"Scott McPhillips [MVP]" <scottmcp@mvps.org.nothere> ????
news:ekFbQqlaEHA.2908@TK2MSFTNGP10.phx.gbl...
> hostran wrote:
> > Hi!
> >
> > I use WM_COPYDATA in CMainFrame,
> >
> > I use the ClassWizard to make following:
> >
> > ON_WM_COPYDATA()
> > afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct);
> > BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct)
> >
> > The code run naturally but after "SendMessage(dlg->m_hWnd, WM_COPYDATA,
0,
> > (UINT)(&cds));"
> > it can't go into the function "BOOL CMainFrame::OnCopyData(CWnd*
> > pWnd,COPYDATASTRUCT* pCopyDataStruct)" why?
> >
> >
> > Thanks in advance!
> >
> >
> >
>
> It looks like you are sending the message to dlg, not CMainFrame. Is
> dlg->m_hWnd a valid hwnd, and is it the mainframe's hwnd?
>
> --
> Scott McPhillips [VC++ MVP]
>