EDN Admin
Well-known member
Hello,
I have a dialog box where I have a tree control and a ListBox. The tree control has list of directories and when user clicks on any one of the mp3 files , it will be updated in the ListBox.
My problem here is when I click on the one mp3 files , the one which is below the clicked file will be selected and is updated in ListBox.
Here is my code
void CCombine::OnClickTree1(NMHDR* pNMHDR, LRESULT* pResult)
{<span style="white-spacere // TODO: Add your control notification handler code here
<span style="white-spacere NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
<span style="white-spacere UINT nFlag;<span style="white-spacere
<span style="white-spacere CString str,buf,ext,m_strPath;
<span style="white-spacere CPoint curPoint;
<span style="white-spacere GetCursorPos(&curPoint);
<span style="white-spacere ScreenToClient(&curPoint);
<span style="white-spacere HTREEITEM hItemSel = m_TreeCtrl.HitTest(curPoint, &nFlag);<span style="white-spacere
<span style="white-spacere str = m_TreeCtrl.GetItemText(hItemSel);<span style="white-spacere
<span style="white-spacere buf = str;
<span style="white-spacere ext = buf.Right(4);
<span style="white-spacere if(ext == ".mp3")
<span style="white-spacere {
<span style="white-spacere <span style="white-spacere m_list.InsertItem(LVIF_TEXT|LVIF_STATE, 0, str,(0%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED, 0, 0);<span style="white-spacere
<span style="white-spacere <span style="white-spacere }
<span style="white-spacere *pResult = 0;
}
Im not able to find the mistake here. Please help me to solve ...
<br/>
Thanks
View the full article
I have a dialog box where I have a tree control and a ListBox. The tree control has list of directories and when user clicks on any one of the mp3 files , it will be updated in the ListBox.
My problem here is when I click on the one mp3 files , the one which is below the clicked file will be selected and is updated in ListBox.
Here is my code
void CCombine::OnClickTree1(NMHDR* pNMHDR, LRESULT* pResult)
{<span style="white-spacere // TODO: Add your control notification handler code here
<span style="white-spacere NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
<span style="white-spacere UINT nFlag;<span style="white-spacere
<span style="white-spacere CString str,buf,ext,m_strPath;
<span style="white-spacere CPoint curPoint;
<span style="white-spacere GetCursorPos(&curPoint);
<span style="white-spacere ScreenToClient(&curPoint);
<span style="white-spacere HTREEITEM hItemSel = m_TreeCtrl.HitTest(curPoint, &nFlag);<span style="white-spacere
<span style="white-spacere str = m_TreeCtrl.GetItemText(hItemSel);<span style="white-spacere
<span style="white-spacere buf = str;
<span style="white-spacere ext = buf.Right(4);
<span style="white-spacere if(ext == ".mp3")
<span style="white-spacere {
<span style="white-spacere <span style="white-spacere m_list.InsertItem(LVIF_TEXT|LVIF_STATE, 0, str,(0%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED, 0, 0);<span style="white-spacere
<span style="white-spacere <span style="white-spacere }
<span style="white-spacere *pResult = 0;
}
Im not able to find the mistake here. Please help me to solve ...
<br/>
Thanks
View the full article