| 1592 | } |
| 1593 | |
| 1594 | HRESULT ShellTreeView::OnBeginDrag(int iItemId,DragType dragType) |
| 1595 | { |
| 1596 | IDataObject *pDataObject = nullptr; |
| 1597 | IDragSourceHelper *pDragSourceHelper = nullptr; |
| 1598 | IShellFolder *pShellFolder = nullptr; |
| 1599 | PCITEMID_CHILD ridl = nullptr; |
| 1600 | DWORD effect; |
| 1601 | POINT pt = {0,0}; |
| 1602 | HRESULT hr; |
| 1603 | |
| 1604 | hr = CoCreateInstance(CLSID_DragDropHelper, nullptr,CLSCTX_ALL, |
| 1605 | IID_PPV_ARGS(&pDragSourceHelper)); |
| 1606 | |
| 1607 | if(SUCCEEDED(hr)) |
| 1608 | { |
| 1609 | hr = SHBindToParent(m_itemInfoMap.at(iItemId).pidl.get(), IID_PPV_ARGS(&pShellFolder), &ridl); |
| 1610 | |
| 1611 | if(SUCCEEDED(hr)) |
| 1612 | { |
| 1613 | /* Needs to be done from the parent folder for the drag/dop to work correctly. |
| 1614 | If done from the desktop folder, only links to files are created. They are |
| 1615 | not copied/moved. */ |
| 1616 | GetUIObjectOf(pShellFolder, m_hTreeView, 1, &ridl, IID_PPV_ARGS(&pDataObject)); |
| 1617 | |
| 1618 | pDragSourceHelper->InitializeFromWindow(m_hTreeView,&pt,pDataObject); |
| 1619 | |
| 1620 | m_DragType = dragType; |
| 1621 | |
| 1622 | hr = DoDragDrop(pDataObject,this,DROPEFFECT_COPY|DROPEFFECT_MOVE| |
| 1623 | DROPEFFECT_LINK,&effect); |
| 1624 | |
| 1625 | m_bDragging = FALSE; |
| 1626 | |
| 1627 | pDataObject->Release(); |
| 1628 | pShellFolder->Release(); |
| 1629 | } |
| 1630 | |
| 1631 | pDragSourceHelper->Release(); |
| 1632 | } |
| 1633 | |
| 1634 | return hr; |
| 1635 | } |
| 1636 | |
| 1637 | BOOL ShellTreeView::IsDesktop(const TCHAR *szPath) |
| 1638 | { |
nothing calls this directly
no test coverage detected