Dave's Brain

Browse - Programming Tips - Why am I not getting a LBN_SELCHANGE from my listbox?

Date: 2009jan5
Platform: win32
Language: C/C++

Q.  Why am I not getting a LBN_SELCHANGE from my listbox?

A. Does the listbox have LBS_NOTIFY style?

Are you looking for it in the right place?
It's in a WM_COMMAND to the parent.

Example code that works:

static BOOL INT_PTR CALLBACK MyDlgProc(const HWND hDlg, UINT message, WPARAM wParam, LPARAM) { switch (message) { case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_WEEKS: if (HIWORD(wParam) == LBN_SELCHANGE) { // Do something } break; } } }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.