void CDragListCtrl::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult)
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	*pResult = 0;

	CPoint ptAction( pNMListView->ptAction );

	m_bCreateDragImage = TRUE;
	m_pDragImage = CLiveList::CreateDragImage( this, ptAction );
	m_bCreateDragImage = FALSE;

	if ( m_pDragImage == NULL ) return;
	m_nDragDrop = -1;

	UpdateWindow();

	CRect rcClient;
	GetClientRect( &rcClient );
	ClientToScreen( &rcClient );
	ClipCursor( &rcClient );
	SetCapture();

	SetFocus();
	UpdateWindow();

	m_pDragImage->DragEnter( this, ptAction );
}
Example #2
0
void CMyTreeCtrl::OnBeginDrag(LPNMHDR pnmhdr, LRESULT *pLResult)
{
	CPoint		ptAction(0,0);

	*pLResult = 0;

	// This code is to prevent accidental drags.
	if( (GetTickCount() - m_dwDragStart) < DRAG_DELAY )
		return;
	
	// Set up the timer
	m_nTimerIDScroll = SetTimer( TIMER_ID_SCROLL, 25, NULL);

	ASSERT( !m_bDragging );
	m_hitemDrag = (( NM_TREEVIEW * )pnmhdr )->itemNew.hItem;

	m_bDragging = TRUE;
	m_hitemDrop = NULL;

	ASSERT(m_pimagelist == NULL);
	m_pimagelist = CreateDragImage(m_hitemDrag);  // get the image list for dragging
	m_pimagelist->DragShowNolock(TRUE);
	m_pimagelist->SetDragCursorImage(0, CPoint(0, 0));
	m_pimagelist->BeginDrag(0, CPoint(0,0));
	m_pimagelist->DragMove(ptAction);
	m_pimagelist->DragEnter(this, ptAction);
	SetCapture();

}
void CLibraryDetailView::OnBeginDrag(NM_LISTVIEW* pNotify, LRESULT* pResult)
{
	GET_LIST();

	CPoint ptAction( pNotify->ptAction );

	m_bCreateDragImage = TRUE;
	CImageList* pImage = CLiveList::CreateDragImage( pList, ptAction );
	m_bCreateDragImage = FALSE;

	if ( pImage == NULL ) return;

	UpdateWindow();

	ClientToScreen( &ptAction );
	DragObjects( pImage, ptAction );
}