Microsoft Windows 9x/NT are 32-bit windows operating systems. However, programs on Window 3.x systems are 16-bit programs. This means, integers in Windows 3.x programs are like those in MS-DOS programs, but integers in Windows 9x/NT programs are 32-bit integers, so they equal to long int's but not short int's.
The structure of a Windows 3.x program is usually simpler than that of a Windows 9x/NT program, so I'll talk about the former first:
From the text above you can see, a windows program is message-driven. That is to say, a windows program should wait for messages, then respond to them. Of course, due to this design, the state of the application should be recorded between two messages.
Actually there is a mechanism that sometimes makes this simpler: Windows uses call-back functions to process messages. They are called back when messages arrive. Surpose in a window procedure, a modal dialog box is started. As the dialog box cannot return immediately, the window procedure is held there. Actually, after the dialog box is created, the code of the window procedure is quitted but the position of the breaking is preserved, and the data are also preserved. When further messages arrive, the window procedure still works. When the dialog box quits, the window procedure is resumed at the recorded position and provided with the preserved data. The more modal dialogs are opened, the more data are preserved, so the more memory is consumed.
A Windows 9x/NT program has the similar basic structure, plus: threads are available. There are two kinds of threads available: working threads and window threads. A program usually starts with a window thread. As I talked earlier in the article "Windows Process Management in My Guess", working threads differ from window threads so that they provide better support for long processing. Threads provide us a way to have one program do several jobs at the same moment.