> When the thread posts the custom message, put the int result into the wParam or lParam that is part of the message. That way the message handler function will receive the new value in the parameter.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
Thank you for your hint.
>>When the thread posts the custom message, put the int result into the wParam or lParam that is part of the message. That way the message handler function will receive the new value in the parameter.
I declare in the CWorkerThreadMgr class an integer member variable c
and
I post the message to the gui like this:
PostMessage (pCalculateMgr-> m_hWnd,
WM_SENDCALCULATED_VALUE,pCalculateMgr-> c,0);
and the OnSendCalculatedValue looks like this:
LRESULT CStartCalculationDlg::OnSendCalculatedValue( WPARAM, LPARAM )
{
//m_WorkerThreadMgr: instance of the CWorkerThreadMgr class and
declared as member in the
// in the CStartCalculationDlg class
m_WorkerThreadMgr.c=rand()*m_Slider.GetPos();
m_Calculation.Format(_T("%d"),m_WorkerThreadMgr.c);
SetDlgItemText(IDC_CALCULATION, m_Calculation);
return 1;
}
Is it what you meant or did I get it wrong?
thank you