I added a Listbox control to a dialog resource called IDC_LIST1. Should I interact with this control using SendDlgItemMessage(), or is there a better way with WTL? Here are my event handlers. Nothing has been invented yet!
LRESULT OnAddItem(WORD , WORD wID, HWND , BOOL& )
{
SendDlgItemMessage(IDC_LIST1, LB_INSERTSTRING, (WPARAM) 0, (LPARAM)_T("Hi"));
return 0;
}
LRESULT OnRemoveItem(WORD , WORD wID, HWND , BOOL& )
{
int item = SendDlgItemMessage(IDC_LIST1, LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
SendDlgItemMessage(IDC_LIST1, LB_DELETESTRING, (WPARAM) 0, (LPARAM)item);
return 0;
}
source
share