Windows programs rely on the normal C techniques of program flow control. The main difference in flow control between a Windows program and a C program is the Windows messaging system.
A message is information that describes an event. The event can be a mouse click, a keystroke, an action the user performs, or information the program generates itself.
Windows takes this information and places it in a system queue (a queue is similar to an array). Each event is moved into the system queue and then removed and copied to the appropriate program queue. The program retrieves the event, translates it, and dispatches it to the program's window function. The function carries out action based on the type of event that occurred.
Windows programs use while statements and switch statements to implement this messaging system.