I'd like to put a workerthread inside OnInidialog but I always get Debug Error when trying to execute the program. It compiles fine, only fails in debuggin and execution.
The error message is something like

Debug error - (title)
blah blah... an unusual error occurs, the program has to stop.


If I comment the workerthread out of the Oninitdialog, things become OK again

Thank you