laiason5
May 17th, 1999, 09:41 PM
ok, heres the deal. im tryin to learn mfc and here i am on tree controls. im trying to implement drag n' drop with them but the problem is that when i try to CreateDragImage(...), it always returns null. this is the code im usin(consequently its from the samples page on codeguru)
void CMyTreeCtrl::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
*pResult = 0;
m_hitemDrag = pNMTreeView->itemNew.hItem;
m_hitemDrop = NULL;
m_pDragImage = CreateDragImage(m_hitemDrag); //WHY WONT THIS RETURN A VALUE???
if(!m_pDragImage)
return;
m_bLDragging = true;
m_pDragImage->BeginDrag(0, CPoint(0,0) );
POINT pt = pNMTreeView->ptDrag;
ClientToScreen(&pt);
m_pDragImage->DragEnter(NULL, pt);
SetCapture();
}
i have a major programming project due in three weeks so any reply would be welcome.
thanks
L5
void CMyTreeCtrl::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
*pResult = 0;
m_hitemDrag = pNMTreeView->itemNew.hItem;
m_hitemDrop = NULL;
m_pDragImage = CreateDragImage(m_hitemDrag); //WHY WONT THIS RETURN A VALUE???
if(!m_pDragImage)
return;
m_bLDragging = true;
m_pDragImage->BeginDrag(0, CPoint(0,0) );
POINT pt = pNMTreeView->ptDrag;
ClientToScreen(&pt);
m_pDragImage->DragEnter(NULL, pt);
SetCapture();
}
i have a major programming project due in three weeks so any reply would be welcome.
thanks
L5