Re: MFC and threads

Tech-Archive recommends: Fix windows errors by optimizing your registry



Doug Harrison [MVP] wrote:

I'd submit this is even simpler:

UINT CMyThread::Query()
{
return (UINT) target->SendMessage(UWM_QUERY_WHATEVER);
}

ON_[REGISTERED_]MESSAGE(UWM_QUERY_WHATEVER, OnQueryWhatever)

LRESULT CMyWindow::OnQueryWhatever(WPARAM, LPARAM)
{
return dlg.DoModal();
}


Doug:

Yes, this is how I would do it also. IMHO, prejudice against SendMessage() often leads to unnecessarily complex solutions.

David Wilkinson

.



Relevant Pages

  • Re: WNDPROC, where is it?
    ... typedef LRESULT (HWND, UINT, WPARAM, LPARAM); ... If I may start from the begining, LRESULT is defined in windef.h as a long ...
    (microsoft.public.vc.language)
  • Re: MFC and threads
    ... UINT CMyThread::Query ... QueryParameters parms; ... LRESULT CMyWindow::OnQueryWhatever(WPARAM wParam, LPARAM) ...
    (microsoft.public.vc.mfc)
  • multi-thread problem
    ... I am not sure how to correctly write this Worker Thread example program. ... UINT CThreadTestDlg::Thread1 ... LRESULT CThreadTestDlg::OnThreadFinished(UINT wParam, LONG lParam) ...
    (microsoft.public.vc.mfc)
  • Re: forwards declarations!
    ... typedef long WPARAM; ... typedef long LPARAM; ... typedef LRESULT; ... HWND hwnd; ...
    (microsoft.public.vc.language)
  • Re: long, LONG anf LPARAM
    ... WPARAM, LPARAM, LRESULT can all be 64 bits on Win64. ...
    (microsoft.public.vc.mfc)