Hi, in the first case, the interface freezes because it is the main thread that is executing the "Solver" function and it is not handling the message queue any more as long as inside the "Solver" function there is no getMessage and no message handling routine.
I would declare the "Solver" function as static inside the class and then start the thread with the CreateThread function:
In Model.h
class CModel
{
static UINT Solver(LPVOID pParam);
}
In Model.cpp
UINT CModel::Solver(LPVOID pParam)
{
return 0;
}
And finally:
void CJewelDoc::OnBstart()
{
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CModel::Solver, NULL, NULL, NULL);
}
Should be quite the same as your second solution, but it works for me without freezing the interface..