windows程序设计 架构概述

来源:互联网 发布:北京纸箱厂 淘宝定做 编辑:程序博客网 时间:2024/04/27 23:58

An Architectural Overview

Every windowthat a program creates has an associated window procedure. This windowprocedure is a function that could be either in the program itself or in adynamic-link library. Windows sends a message to a window by calling the windowprocedure. The window procedure does some processing based on the message andthen returns control to Windows.

Moreprecisely, a window is always created based on a "window class." Thewindow class identifies the window procedure that processes messages to thewindow. The use of a window class allows multiple windows to be based on thesame window class and hence use the same window procedure. For example, all buttons in allWindows programs are based on the same window class. This window class isassociated with a window procedure located in a Windows dynamic-link librarythat processes messages to all the button windows.

When aWindows program begins execution, Windows creates a "message queue"for the program. This message queue stores messages to all the windows aprogram might create. A Windows application includes a short chunk of codecalled the "message loop" to retrieve these messages from the queueand dispatch them to the appropriate window procedure. Other messages are sentdirectly to the window procedure without being placed in the message queue.

0 0