Windows is a nonpreemptive multitasking system. This means that it cannot take control from an application. Instead, the application must yield control before Windows can reassign control to another application.
To make sure that all applications have equal access to the CPU, the GetMessage function automatically yields control when there are no messages in an application queue. This means that if there is no work for the application to do, Windows can give control to another application. Since all applications have a message loop, this implicit yielding of control guarantees that control is shared.
In general, you should rely on the GetMessage function to yield for your application. Although a function (Yield) is available that explicitly yields control, you should avoid using it. Since there might be times when your application must keep control for a long time, such as when writing a large buffer to a file, you should try to minimize the work and provide a visual clue to the user that a lengthy operation is under way.