OK, that looks good.
I have another question. I have some edit boxes and lists that are
constantly getting updated info from my code(inside CvcatTransmit), how
can I point to those within my new CThread class?
Here's the code. thread is declared inside of vcatTransmit.h as
CThread * thread;
void CvcatTransmit::OnTransmitStart()
{
thread = (CThread *)AfxBeginThread(RUNTIME_CLASS(CThread),
THREAD_PRIORITY_NORMAL,
0, //stacksize
CREATE_SUSPENDED);
thread->SetMe = true;
thread->ResumeThread();
}
void CvcatTransmit::OnTransmitStop()
{
thread->PostThreadMessage(WM_QUIT, 0, 0);
}
Joseph M. Newcomer wrote:
That's what should happen. You should do
thread.Create();
where thread is a variable of type CMyThread, and which has a scope that
lasts as long as
the thread will be running. Alternatively, you can allocate it on the
heap.
When you are reporting things like this, show the exact code, not just
some handwave that
suggests what the code might look like.
joe
On 7 Sep 2006 13:36:02 -0700, kefkastudio@gmail.com wrote:
Thanks for pointing that out to me. I created the class CMyThread from
ClassWizard wirh CWinThread as the base, implemented CMyThread * thread
= AfxBegin.. and I keep getting this one error..
cannot convert from 'class CWinThread *' to 'class CMyThread *' Types
pointed to are unrelated.
I'm missing something here..
Frank B.
Joseph M. Newcomer wrote:
See my essay on worker threads on my MVP Tips site.
joe
On 7 Sep 2006 09:32:19 -0700, kefkastudio@gmail.com wrote:
I have a button which starts and stops my program from performing a
task. Everytime the user hits start, two worker threads do their
stuff. When I hit stop, both threads close down. Right now I have
some pretty dumb threads getting signaled with global variables.
I'm
trying to find a better way to do this..
Frank B.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Joseph M. Newcomer [MVP]