I'm working on a program in Visual C++ 2k8 and I've got a button that is responsible for creating and ending a thread. It's controlled by a switch statement that changes a boolean from true to false and depending on the value of the boolean, its going to start or a thread.
I'm using the function AfxBeginThread to start my thread, I'm just confused how to end it (how can I scan for the button being pressed again, or how do I stop the thread. I've been warned not to use AfxEndThread because it's somehow dangerous).
Any help will be greatly appreciated.