Index: Requirements
Problems Companies
Platforms Languages
Software Research
- Part of Win32.
- Messages: Used for event notification and communication between components.
Arguments include a window target, a message id, and two long arguments.
The meaning of the arguments depends on the message id. The arguments must
be cast into the appropriate type, which is a pain, but there are mechanisms
to make that easier, like Cracker macros and Wizards that write code for
you.
- Crackers: type safe message handler calling macros. Message handlers
all pass their message and data as three long arguments: the command, and
two longs. Depending on the command, the longs are interpreted differently,
and need to be type cast and possibly have fields extracted. Crackers are
macros and function prototypes for system message handlers that take nice
digested arguments. For each system message, there is a macro that cracks
open the standard two long message args and calls the handler function with
sensibly typed arguments, and also an uncracker macro that squishes the
typed args back into the two longs, useful when your handler function wants
to delegate to another message handler that takes two longs. The cracker
name is based on the message name, and there is a macro for writing cases
in the main message loop that just take the message name and your handler
name, and expand into a switch case that handles the command, by converting
the arguments, and calling the function, in a type safe manner. Then you
just write the handler functions according to the protypes, and don't have
any casts in your code, and the message handling loop is much easier to
write. You can write your own crackers for your own message codes, based
on the examples in "windowsx.h", which correspond to the system
message codes.
- Message Maps: Macros for automatically dispatching messages to message
handlers. Similar to COM IUnknown "Interface Maps",
and OLE Automation "Dispatch Maps". Code
for defining Message Maps is automatically generated by the MSDEV
Class Wizard.