Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I created an app that use a CSplitterWnd to make 2 pane of class CListView. One of thst pane is set as parent of a modeless dialog box that pop up in some particular conditions.
Inside this modeless dialog box I need to know parent window handle for manipulating list view parent window associated according user choices.
Here is my code:
void CDlgLstAd::OnItemchangedLisact(NMHDR* pNMHDR, LRESULT* pResult)
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
if((pNMListView->uNewState & LVIS_SELECTED) == LVIS_SELECTED)
// get associated data
long lParam = (long)pNMListView->lParam;
// SOMETHING WRONG HERE ??
// get parent window
CListView* pCtrView = (CListView*)GetParent();
// get list ctrl associated
CListCtrl& list = pCtrView->GetListCtrl();
// find item and select it
lvf.flags = LVFI_PARAM;
lvf.lParam = lParam;
int idx = list.FindItem(&lvf, -1);
list.SetItemState(idx, LVIS_SELECTED, LVIS_SELECTED);
*pResult = 0;
But this code not work.The parent window do not respond. What's wrong ?
Thanks in advance.
0 · ·