Listbox SendMessage with LV_DISPINFO
-
I'm trying to send a message from my ListBox custom class to another class which utilizes the control. In the Listbox control I build a LV_DISPINFO struct and then pass it to a SendMessage method to be used by the OnNotify message in the calling class. In this example CCreateWorldStep1Dlg uses the ListBox custom control whereas the ListBox custom control passes a message back to CCreateWorldStep1Dlg as a Notify message.
void CCreateWorldStep1Dlg::OnNotify(UINT message, LPARAM lParam) { CString Buffer; LV_DISPINFO *pInfo = (LV_DISPINFO *)lParam; pListBox->GetText(pListBox->GetCurSel(), Buffer); if(pListBox->GetCurSel() == pListBox->GetCount() - 1) pRegionsArray->Add(Buffer); else pRegionsArray->SetAt(pListBox->GetCurSel(), Buffer); }
The problem is that variable pInfo contains garbage when I look at it. May I be converting the lParam incorrectly? This is how I am sending the messageGetParent()->GetParent()->SendMessage(WM_NOTIFY, m_DlgID, (LPARAM)&dispinfo);
Thanks for the help "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."