Yielding Control

All Windows programs must periodically check to see if any Windows messages need processing. Windows programs have a message loop that constantly monitors messages placed in the event queue.

QuickWin programs don't require event loops, and most of the message handling is done automatically. However, there are certain situations where a QuickWin program must manually yield control to Windows or other programs.

For example, if you have a lengthy numeric processing loop, no Windows messages can be processed while the program is executing the loop. With no messages available, you can't access menus or activate other Windows programs, and your own program appears “broken” while in the loop.

In cases like this, use the _wyield function. The routine lets Windows determine if any messages are present and processes them as appropriate. In a long loop, insert _wyield where it is called repeatedly. This assures Windows messages are processed.

The _wyield function isn't passed any arguments and doesn't return a value.