Ok so if you have a program that calculates alot of stuff at once, then sometimes the dialog messes up (the whole thing is white 'cept for toolbar). I'm thinking the best way to correct this is to put calculations in a new thread, is this a solution or is there a better way?
One solution is multithreading.
is there a way to close a thread within itself? like when the code is done in the thread, it can close itself?
When the threads function executes a return statement it will end. If you created the thread with beginthread() the threads handle will close automatically as well. If you used beginthreadex() you must close the handle yourself.
There are also API functions for stopping threads, but that is usually enough.
Here is a nice thread class you can use (if using C++).