timers in vc++

I have a timer which was working proeprly before adding threads, now i have added thread funtion after that timer is not displayed on the dialog window can anyone tell me what is the cause ....

--------------
BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
HANDLE hr;
hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,this,0,0);
return TRUE;
}

----------------

UINT WorkerThreadProc(LPVOID Param)
{
CStatusDlg* status = (CStatusDlg *)Param;

time(&lStartTime);
SetTimer(NULL,ELAPSED_TIMER, 1000, NULL);
INDX.startIndex();
return true;
}
----------------

void CStatusDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == ELAPSED_TIMER)
{
time(&lStopTime);
cteElapsedTime = CTimeSpan(lStopTime-lStartTime);
CString csElapsedTime;
csElapsedTime.Format("%02d:%02d:%02d",
cteElapsedTime.GetHours(),
cteElapsedTime.GetMinutes(),
cteElapsedTime.GetSeconds());
if(IsWindowVisible())
{
m_TIME.SetWindowText(csElapsedTime);
}
}
CDialog::OnTimer(nIDEvent);
}
[1223 byte] By [Rameshraju_b] at [2007-11-19 21:51:09]
# 1 Re: timers in vc++
I have a timer which was working proeprly before adding threads, now i have added thread funtion after that timer is not displayed on the dialog window can anyone tell me what is the cause...You are not associating the timer to any window (you are passing NULL as the first parameter to ::SetTimer(), instead of your dialog's window handle). Also, note that you shouldn't use CWnd-derived objects across threads.
gstercken at 2007-11-10 23:36:34 >