as i know, i can stop thread use AfxEndThread from inside thread. if i want to stop all thread from other function. how can i?

below is my framework code

Code:
void CComputer::OnButtonStart() 
{
...
...

AfxBeginThread(&thread,0);	
}

UINT thread(LPVOID p)
{
...
...
}

// stop my thread
void CComputer::OnButtonStop() 
{
// what code ??
}