Recently a colleague of mine asked this question, he added a message map entry for LBN_SELCHANGE but still no notification message arrived and also this list box was dynamically created using CListBox::Create function.
The reason was that he missed out a style id while creating this window. LBS_NOTIFY should be specified when creating a list box if parent window intends to receive notification messages. List box created using resource editor has this option turned on by default.
Some other controls with a similar style id are as follows…
- Button control has BS_NOTIFY style which enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style.
- Static control has SS_NOTIFY style which enables it to send it’s parent window STN_CLICKED, STN_DBLCLK, STN_DISABLE, and STN_ENABLE notification messages when the user clicks or double-clicks the control.