Re: Critical section-Updating the Dialog from Workerthread
On 29 mar, 19:43, scott...@mvps.org wrote:
No, that's not what I meant. The posted value is received in the wParam, =
but you are not doing anything with the received wParam.
LRESULT CStartCalculationDlg::OnSendCalculatedValue( WPARAM newvalue, LPA=
RAM )
{
m_Calculation.Format(_T("%d"), (int) newvalue);
I'm not quite sure to have understood. So, you mean:
LRESULT CStartCalculationDlg::OnSendCalculatedValue( WPARAM newvalue,
LPARAM )
{
newvalue=rand()*m_Slider.GetPos();
m_Calculation.Format(_T("%d"), (int) newvalue);
....
}
and in the Thread procedure:
PostMessage (pCalculateMgr-> m_hWnd,
WM_SENDCALCULATED_VALUE,pCalculateMgr->(WPARAM)c,0);
right?
Is there a possibility to calculate in the Thread procedure the
operation rand()*m_Slider.GetPos() and send the result via PostMessage
instead of doing it in the OnSendCalculatedValue( WPARAM, LPARAM )
method? In that case, how can I access m_Slider since it's not allowed
to touch gui controls in the Thread procedure?
Thank you