Asynchronous Input and the Window Manager

The elimination of address space constraints permeates many aspects of the windows environment as well. For example, timers are no longer precious objects. Feel free to create and use as many as you like (but be aware that they are a poor man's substitute for threads in certain cases).

Arguably the biggest difference between the 16-bit and 32-bit window manager is the asynchronous input model. On 16-bit Windows you have a synchronous input model, sometimes called "cooperative multitasking." In this model, each application must always process its messages because every application saw every message and if you did not process each one and yield to another program quickly, you would hold up all the other programs on the system. This necessitated a coding style where the most frequently called API was PeekMessage, because every application constantly had to check the message queue for messages and pass them on. If they did not, the system would appear to hang. (This also gave rise to a generation of applications that, by default, loop in the processor checking for messages with PeekMessage instead of calling GetMessage which will return control to the window system until a message arrives. This does not really hurt anything, but as a coding style we find it offensive. We'll have no more of that, thank you.)

On Windows NT, messages are sent only to the processes that need to see them. If one process ceases to deal with its messages it may become unresponsive and may cease to update its display area, but the rest of the system will carry on just fine. This means PeekMessage no longer has to be the most popular API in the system. You still want to remain responsive to the user, of course, so you should still call it, but maybe not so often.

For the window manager, it is more important than ever that you write your application using Unicode. Having to translate everything that goes onto the display from ASCII to Unicode slows the important path from your application to the user's vision. Unicode, Unicode, Unicode. We love Unicode.