// picks the current target
void CXTPCustomizeDropSource::PickTarget(CPoint point)
{
	HWND hWndPoint = WindowFromPoint(point);

	BOOL bFound = FALSE;

	for (int i = (int)m_arrTargets.GetSize() - 1; i >= 0; i--)
	{
		CXTPCommandBar* pCommandBar = m_arrTargets[i];

		if (pCommandBar->IsVisible() && CXTPWindowRect(pCommandBar).PtInRect(point)
			&& (pCommandBar->GetSafeHwnd() == hWndPoint || ::IsChild(pCommandBar->GetSafeHwnd(), hWndPoint)))
		{
			bFound = TRUE;

			if (m_pTarget == pCommandBar)
			{
				m_pTarget->ScreenToClient(&point);
				m_pTarget->OnCustomizeDragOver(m_pControl, point);
			}
			else if (m_pTarget != NULL)
			{
				m_pTarget->OnCustomizeDragLeave();
				m_pTarget = 0;
			}

			if (m_pTarget == 0)
			{
				pCommandBar->ScreenToClient(&point);
				if (pCommandBar->OnCustomizeDragEnter(m_pControl, point) != DROPEFFECT_NONE)
				{
					m_pTarget = pCommandBar;
				}
			}
			break;
		}
	}

	if (!bFound && m_pTarget)
	{
		m_pTarget->OnCustomizeDragLeave();
		m_pTarget = 0;
	}


	// set the cursor as appropriate
	FreshenCursor();
}