When writing or reading from a large file, many of the amateur programs I’ve used end up freezing, which is understandable considering the size of the file it’s reading or writing. When moving a file in windows are unzipping a program, or something like that, the programs never freeze and you can move the window around or cancel the operation.
How is this done? Do they have intermittent pauses in the operations to allow for the calculation of a button press or window movement instead of adding it to the end of the large operation? If so, how is this done?
Chances are good the program spawns multiple threads of control. One thread is put in charge of the Windows message loop so resizes, repaints, redraws, minimize / maximize etc. are all handled in a visually pleasing manner and clicking the “cancel” button can interrupt the other threads of control that manage compute-intensive or IO-intensive operations.