Home > MFC, Windows API > Why am I not receiving LBN_SELCHANGE for a list box?

Why am I not receiving LBN_SELCHANGE for a list box?

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…

  1. 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.
  2. 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.
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: