From a search of this board for LBN_SELCHANGE:
http://www.cprogramming.com/cboard/s...t=LBNSELCHANGE
Or, you could try something like (untested):
Code:
case WM_COMMAND:
{
WORD wNotify; /* notification code */
WORD wID; /* control id */
HWND hCntrl; /* control handle */
int nSelected; /* zero-based index of selected listbox item */
int nLen; /* listbox item number of TCHARS (ie str length) */
TCHAR *chBuffer; /* for listbox item text */
wID=LOWORD(wParam);
wNotify=HIWORD(wParam);
hCntrl=(HWND)lParam;
if (hCntrl && wNotify==LBN_SELCHANGE && wID==IDC_LIST)
{
nSelected=SendMessage(hCntrl, LB_GETCURSEL, 0, 0);
nLen=SendMessage(hCntrl, LB_GETTEXTLEN, nSelected, 0);
chBuffer=(TCHAR*)malloc((nLen+1)*sizeof(TCHAR));
if (chBuffer)
{
SendMessage(hCntrl, LB_GETTEXT, nSelected, (LPARAM)chBuffer);
/* 'hEdit' is handle to edit control*/
SetWindowText(hEdit,chBuffer);
free(chBuffer);
}
}
return 0;
}
edit: editing