Code sample two threads updating
All of the code in there is executed on a different thread and for that reason you are not allowed to touch the UI from it.
The most difficult concept about multi-threading in a Windows application is the fact that you are not allowed to make changes to the UI from another thread - if you do, the application will immediately crash.
You can create additional threads in your application if you want.
You might want to do this to handle background or maintenance tasks when you do not want the user to wait for them to complete.
Worker threads are commonly used to complete tasks, such as recalculation, that do not require user input.
The Win32 API does not distinguish between types of threads; it just needs to know the thread's starting address so it can begin to execute the thread.
Search for code sample two threads updating:
When performing a task on a different thread, you usually have to communicate with the rest of the application in two situations: When you want to update it to show how far you are in the process, and then of course when the task is done and you want to show the result.