hi,
Recently, i got an "atlsimpstr.h access violation reading location" error when run my project.

I'm using two threads in my project. If i run single thread the above error did not come.

Code:
UINT MainSequence(LPVOID pVoid)
{
	HWND hwnd = (HWND)pVoid;
	CMainDlg *Main = CMainDlg *)pVoid; 			

	while(1)
	{
	  // do some process
	}
return 0;
}

UINT SignalSequence(LPVOID pVoid)
{
	HWND hwnd = (HWND)pVoid;
	CMainDlg *Main = CMainDlg *)pVoid; 
	while(1)
	{
	  // do some process
	}
return 0;
}


CWinThread *tMain;
CWinThread *tSignal;
BOOL CMainDlg::OnInitDialog()
{
   CDialog::OnInitDialog();
   tMain   = AfxBeginThread(MainSequence, LPVOID(NULL));
   tSignal = AfxBeginThread(SignalSequence, LPVOID(NULL));

   return TRUE;
}
If i command tMain thread , no error occurs.
How can i handle these two threads?