Print Page | Close Window

Drag and Drop

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2072
Printed Date: 07 November 2025 at 2:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Drag and Drop
Posted By: manoj
Subject: Drag and Drop
Date Posted: 05 April 2005 at 4:57am

Hi

I am using Xtreme Toolkit Pro v9.60, I create a SDI application and create a list control in CXTPDockingPane. Now I want to drag a file and drop in that list control.

Please tell me how can i do this if possible then pls send me small sample code.

 

Manoj Jangid  




Replies:
Posted By: Oleg
Date Posted: 06 April 2005 at 3:47am

you can use CListView instead of CListCtrl and override members of CView:

 

DROPEFFECT CView::OnDragEnter(COleDataObject* /*pDataObject*/,

DWORD /*dwKeyState*/, CPoint /*point*/)

{

return 0; // DROPEFFECT_NONE

}

DROPEFFECT CView::OnDragOver(COleDataObject* /*pDataObject*/,

DWORD /*dwKeyState*/, CPoint /*point*/)

{

return 0; // DROPEFFECT_NONE

}

BOOL CView::OnDrop(COleDataObject* /*pDataObject*/,

DROPEFFECT /*dropEffect*/, CPoint /*point*/)

{

return FALSE;

}



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Oleg
Date Posted: 06 April 2005 at 3:52am

Or if you need _only files_ dragging

 

1. Call  m_wndList.DragAcceptFiles(TRUE);

2. Add ON_WM_DROPFILES() to message map

3. add member like

 

void CYourListCtrl::OnDropFiles(HDROP hDropInfo)

{

UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);

for (UINT iFile = 0; iFile < nFiles; iFile++)

{

TCHAR szFileName[_MAX_PATH];

::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);

Process(szFileName);

}

::DragFinish(hDropInfo);

}



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net