文档介绍:MFC and Visualized Programming
Chaper 1 Windows Programming and
MFC Introducing
Index
p The Windows Programming Model
n Message Processing
n Handles
n Windows APIs
n A Windows Program
p Introducing MFC
n The Visual C++ Components
n MFC Application Framework
The Windows Programming Model
p Programs written for traditional operating
environments use a procedural programming
model in which programs execute from top to
bottom in an orderly fashion.
p The path taken from start to finish may vary with
each invocation of the program depending on the
input it receives or the conditions under which it is
run, but the path remains fairly predictable.
The Windows Programming Model
p In a C program, execution begins with the first
line in the function named main and ends when
main returns.
In between, main might call other functions and
these functions might call even more functions,
but ultimately it is the program— not the
operating system— that determines what gets
called and when.
example1
The Windows Programming Model
p Windows programs operate differently. They use
the event-driven programming model, in which
applications respond to events by processing
messages sent by the operating system.
p An event could be a keystroke, a mouse click, or a
command for a window to repaint itself, among
other things.
The Windows Programming Model
Message Processing
p Where do e from, and what
kinds of information do they convey?
Windows defines hundreds of different message
types. Most messages have names that begin
with the letters "WM" and an underscore, as
in WM_CREATE and WM_PAINT.
Message Processing
p One way to characterize a Windows program is to
think of it as a collection of message handlers. To a
large extent, it is a program's unique way of
responding to messages that gives it its personality