MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / OnBeginDrag

Method OnBeginDrag

Explorer++/Explorer++/ShellTreeView/ShellTreeView.cpp:1594–1635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1592}
1593
1594HRESULT 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
1637BOOL ShellTreeView::IsDesktop(const TCHAR *szPath)
1638{

Callers

nothing calls this directly

Calls 4

GetUIObjectOfFunction · 0.85
getMethod · 0.45
atMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected