Hi everybody!
I am trying to suspend and resume a thread using two 'Menu' buttons 'Start' & 'Stop'. I have created the thread as below

CWinThread *PWinThread;

OnCreate()
{
int Code = 1;
PWinThread = AfxBeginThread(ThreadFunction, &Code);
}

OnStart()
{
PWinThread->ResumeThread();
}

OnStop()
{
DWORD ExitCode;

PWinThread->SuspendThread();

::GetExitCodeThread(PWinThread->m_hThread, &ExitCode);
if(ExitCode == STILL_ACTIVE)
::MessageBox(0,"Thread","Is still Running",0);
}

When i click on 'Stop' button, I get the messagebox indicating that thread is still active.........can somebody trace it out please..............