Hi,

I have a program which runs a worker thread on startup like this:

_param = new THREADSTRUCT;
_param->_this = this;
AfxBeginThread(StartThread, _param);
SetThreadPriority(_param, THREAD_PRIORITY_IDLE);

The worker function StartThread has a while(TRUE) loop which runs indefinitely in the background and works fine.

The problem is my main program is not working right in some circumstances while the worker thread is active. For example, I have a button which runs an executable using CreateProcess. This takes absolutely forever to start the exe while the worker thread is running. I usually have to close my program before the exe called by CreateProcess actually starts.

Why is this worker thread causing so many problems when I try to do certain things from the main program?

Thanks in advance,
Jim