Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3027

atlsimpstr.h access violation error

$
0
0
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?

Viewing all articles
Browse latest Browse all 3027

Trending Articles