CHAIN_MSG_MAP_MEMBER
CHAIN_MSG_MAP_MEMBER( theChainMember )
Parameters
theChainMember
[in] The name of the data member containing the message map.
Remarks
Defines an entry in a message map. CHAIN_MSG_MAP_MEMBER directs messages to a data member's default message map (declared with BEGIN_MSG_MAP). To direct messages to a data member's alternate message map (declared with ALT_MSG_MAP), use CHAIN_MSG_MAP_ALT_MEMBER.
For example:
class CMyClass : ...
{
public:
CMyContainedClass m_obj;
...
BEGIN_MSG_MAP(CMyClass)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
// chain to default message map of m_obj
CHAIN_MSG_MAP_MEMBER(m_obj)
ALT_MSG_MAP(1)
// chain to default message map of m_obj
CHAIN_MSG_MAP(m_obj)
ALT_MSG_MAP(2)
MESSAGE_HANDLER(WM_CHAR, OnChar)
// chain to alternate message map of m_obj
CHAIN_MSG_MAP_ALT(m_obj, 1)
END_MSG_MAP()
...
};
This example illustrates the following:
If a window procedure is using
CMyClass
's default message map andOnPaint
does not handle a message, the message is directed tom_obj
's default message map for processing.If a window procedure is using the first alternate message map in
CMyClass
, all messages are directed tom_obj
's default message map.If a window procedure is using
CMyClass
's second alternate message map andOnChar
does not handle a message, the message is directed to the specified alternate message map ofm_obj
. ClassCMyContainedClass
must have declared this message map withALT_MSG_MAP(1)
.
Note Always begin a message map with BEGIN_MSG_MAP. You can then declare subsequent alternate message maps with ALT_MSG_MAP. The END_MSG_MAP macro marks the end of the message map. Every message map must have exactly one instance of BEGIN_MSG_MAP and END_MSG_MAP.
For more information about using message maps in ATL, see Message Maps in the article "ATL Window Classes."
ATL Macros and Global Functions
See Also