|
Starting
with chapter one it is very easy to read and recommended for everyone.
The author’s good approach
starts with defining what is a Window, Win32 compared to Win16, Historical
perspective on user Interfaces comparing Windows to DOS or Unix
programs. Then more details are given
about the Window Object, Child windows, Menus, and associated functions.
You will get a good
understanding of the message loop ( Check Figure 1.5 page 17 ), memory models
and operating modes. Linking (
static/dynamic ) DLLs exports and imports.
Memory management, header files and exclude symbols. Then he talks
about Handles, pointers, type checking, naming conventions just to name a
few. Very interesting chapter that
every programmer must fully read to understand the basics.
The second chapter is what I
was hoping for, from a good book, to create a Skeletal Windows Application to
see how the different parts of an application fit together.
The author talks about the
WinMain Function, Parameters and
Initialization, registering the window classes, the WinMain Message
Loop, message handling and the components to the application. You will learn about the resource
definition files, the application header file and more. Then you will build and run the
application.
I like the way this chapter was
organized.
Chapter 3 goes into exploring
the variations on a Window.
You will learn that a window is
associated with a class style to control its appearance and behavior. Also you will learn about the overlapped,
pop-up and child windows.
Owned and unowned windows. All
the details that we now take for granted are discussed in details about a
Window. Then couple of programs shows you examples.
For example you will learn
about the handling of a Child
Windows. How child windows are used
as a control, such as a button, a list box or a check box and there are no
limits here.
Chapter 4 talks about
Displaying Text in a Window.
After you know how to create a
various types and styles of windows
this chapter teaches you how to display text in a window. In this chapter you learn the importance
of a device and display contexts.
Display context needs more explanation and it is done very well in the
next chapter (Chapter 5). The author
explains that all GDI functions require a device context as a parameter. A device context is a link between your
application, a device driver, and an associated output device, such as a
printer or plotter.
Good explanation and guidelines
on how the WM_PAINT Message should be handled, how to process a WM_PAINT
Message and the use of the TextOut to display text.
Very nice explanation of the
Logical and Device Coordinates comes next
and very easy to understand but the author will go into more depth in
chapter 5. More details came about the MM_TEXT Mapping Mode, Text Metrics,
and SYSTEM_FONT etc. If you look on page 170 Figure 4.3 you
will learn few things about the meaning of the fields in the tagTEXTMETRIC
struct. You probably have seen these
fields in PageMaker, QuarkXpress and other graphic applications from Adobe.
The authors wisely Introduces
us to the anatomy and functionality of Scroll Bars, Scroll Bars Parts then
talk about Scrolling Text . Subclassing and subcalssing techniques were explained. Yes this is a diversion but it is
necessary for the Sysinfo sample program that displays text in a window that
scrolls.
Chapter 5 Examining a Device
Context in Depth
This is a must chapter to
read. You will fully understand what
a Device and Display Context is and the four types of display context like
common, class, private and window.
Also the author introduced us
to creating our own device context.
Like a device context for a physical device, information context,
memory device context and metafile device context. I can see lots of details in the attributes of a device context
, like color, Bitmap, Brush, Font, Pen, and Region to name a few. Various Windows Coordinate Systems was
discussed, the viewport, the Window and all Mapping Modes. I really liked this chapter.
Chapter 6: Graphical
Output ( Pixels, Lines, and Polygons )
As you can see you can control
every pixel in a window. You can
create lines, polygons etc… Drawing mode context for example determines how
to copy the “ink” from a pen onto the drawing surface of the device context. For example the “ink” of a pen actually
are combined with the pixel values of the display surface in a bitwise
Boolean operation. This reminded me
when programming against an EVGA adapter and had to use the xor operation. Drawing more complex lines, Drawing Filled
Areas, Drawing Polygons, Creating and using stock and custom brushes. Bitmaps
were given lots of attention in this
chapter and a must read. Also some
advanced windows graphics like Paths and Transformations. Stroked text path and clipped background
is a must see and do. This chapter is pretty long but has lots of exciting
things to learn and do.
Chapter 7 is what I been
waiting for, to read: Keyboard,
Mouse, and Timer Input
If you like to know what
happens when you press a key on the keyboard and see the key displayed and
wonder how is that done and what is involved then you should read this
chapter. You will learn about the
Messages, The Virtual-Key Code, Character Sets, Unicode character sets and
the Caret. Next the Mouse Input,
Mouse Messages, Client and non-Client Mouse Messages, Simple Drag and Drop
Example was nicely done. The Cursor,
Custom Cursors, Loading cursors from other sources, moving the cursor. Timer Input and sending timer messages to
Window Functions or to a Callback function. How to use the timer. Very interesting chapter that can open
your eyes, mind and remember the good old days. This chapter is at a very low level. The next chapter will help you out to be more productive.
Chapter 8 is all about using
Controls Static, Button, and Edit Classes.
This chapter is about the
common requirements of many programs.
To handle user input, allow the user to edit text, make a selection
from a variety of choices, scroll items horizontally and vertically and place
labels on the screen. So, not
reinvent the wheel you need to use controls that give you most to the common
functionality. You will learn how to
create a control in a window, how controls notify its parent of an event, how
to use a control and fonts in a control.
Static Class, Controls, do not send events or accept input. BUT
“Dynamic” Static Controls can
respond to input etc… Button Class,
Button Styles, Messages, Input focus problems, Push buttons, Check Boxes,
Radio Buttons, Owner-Draw Buttons, Group boxes were discussed in depth.
This is a very easy chapter to read and understand. Next the Edit class was explained. Style changing when editing, Messages to
the Edit Control, there are so many of them I mean they fill pages and
pages. Working with Selections, Working
with Copy, Cut and Paste. Multi
line editing controls and Line
Scrolling and Formatting. The next
two chapters 9 and 10 talk about more controls.
Chapter 9 and 10: Using ListBox, ComboBox, ImageList,
TreeView, Scroll Bar, Trackbar, Up/Down, and Progress Classes
This chapter is about non-simple-value controls. These chapters will allow you to view and
scroll many kinds of objects. Again
they talk about the styles available, the messages to the controls, Adding,
Inserting, and Deleting items from each control’s collection and much
more. Single selection, multiple
selection, Scroll Bars, and Notification messages. The authors talk about improving performance on some controls,
Sorting Locales, Getting info about a specific item ( Tree Item) , Smart Drag
and Drop in a tree view that preserves the hierarchy. Label Editing etc…
Chapter 11 is all about Dialog
Boxes.
Again here, as the previous
chapters you will learn how to create a Modal and a Modeless Dialog Boxes and
the different ways to create them.
Parameter passing to a dialog box.
What to do in the Dialog Box Handlers, How to create Dialog Box
Templates in your resource definition file and how to apply limitations on a
Dialog Box like resizing. Now after a
Dialog box in closed how do you return input from a dialog box. Enabling and
Disabling Controls and save the state of the Dialog. How to use idle time to update
Controls. The authors gave very good
examples here to demonstrate the content/concepts of this chapter.
Chapter 12 deals with Menus,
Accelerators, Icons, String Resources, and Message Table Resources.
Menus, accelerations, Icons,
and strings can all be specified in the resource-definition file for a
windows application. This chapter
examines each of these resources.
Again the authors will discuss
the anatomy of each object how they are created, defined, destroyed, modify a
menu by adding, inserting, and deleting menu items.
Then Enabling, Disabling, and
Graying an item on a menu, Checking and Un-checking a menu item. Using a Bitmap
as a custom menu item check mark, and
most important is the Menu Messages, Maintaining menu state, more on menus like Pop-up Menus, Multiple
top level menus. Next Accelerator
keys can be defined in an accelerator table.
How to create (static or dynamic) accelerators , load them and
more. Icons come next and again you
will find how to create, Draw, Display, Icons. String resources came next.
How to define, localize, message formatting and the MessageTable
resources. This is a good chapter
easy to read and understand.
Chapter 13 is about Printing
The author gives a good
overview of the printing process, using the default printer or using any
installed printer. In here you will
benefit form the previous chapters about context to get the printer device
context for any printer. Determining
and setting Device mode values is a breeze.
The parts or elements required in a printing windows application,
getting printer info, allowing other applications to interact while printing
( abort possibilities). Custom Dialog
Templates ( internal and external )were created and hook functions. A general printing DLL, its goals, input
structure, query functions, callbacks, and other functions. And Finally the Page Setup Dialog with
custom painting hooks. I really
learned some good information from this chapter.
Chapter 14 is all about Memory
Management
This is really a very important
chapter. You will learn about dynamic
memory allocation, Fixed, Moveable and discardable memory blocks. Using Global Functions you can
Allocate a fixed, moveable,
descardable, shareable memory blocks.
Also locking and unlocking of memory blocks, relocating, freeing and
other default heap functions.
Dynamic memory allocation
performance issues, System memory organization, Local heap, Global heap,
malloc/new, a section for win16 programmers is also discussed here. The list goes on to Dynamic heaps, Heap
serialization, locality of reference ( reducing heap fragmentations, etc..),
Thread-Local storage this is really important to understand similar concepts
you find in Dot Net.
Chapter 15 is about Fonts
What is a font and the types
found in Windows link: Raster Fonts, Stroke or Vector Fonts, TrueType Fonts,
Font Resources and Device Fonts(PostScipt?).
How to use a Stock Font,
Enumerating Fonts, Defining a Logical Font, and the LOGFONT Structure had
many surprises in their details. The
Font matching scheme and getting info about a font. We have seen other details in a previous chapter. Kerning and well behaved fonts finish the
chapter. As always this book had
some very good examples.
Chapter 16: Dynamic Link Libraries
Well done approach and
organization in this book explain what is a DLL, Static, Dynamic, Benefits,
Constraints (stack, static data), entry point function DLL module definition
file ( importing symbols, importing data, exporting ), DLL Techniques and DLL
hell. This is a good chapter that
you must fully understand. All sort
of options on DLL were shown and discussed here. The subject was made easy to read and understand.
Chapter 17
The Multiple Document
Interface, the behavior of an MDI application and the steps to create such
application. Creating child window,
MDI client window messages.
Good example program followed.
Chapter 18: Synchronization
The basics, what is, problems,
mechanisms and correctness issues.
Synchronizations primitives in Win32 like Semaphores, Mutexes,
Critical Sections, Events, Waiting for Synchronization, Waiting for Threads
and abandoned Mutexes. Good practices in primitives must be used. Avoiding Synchronization via
Messages. Threads creation and
inner-thread control and further examples were shown.
Well this is as I said before,
is a huge book, it is very well written, organized and I loved reading
it. I will read it again from time to
time as a reference to further understand certain parts. The code of 150,000 lines was too much for
anyone to handle is such a short time ( one month ).
I liked the Appendixes and the
beginning of the book where all the Figures and Tables were listed that is
helpful in many ways.
I recommend this book to any programmer.
|