Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Drag and Drop
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Drag and Drop

 Post Reply Post Reply
Author
Message
manoj View Drop Down
Newbie
Newbie
Avatar

Joined: 26 October 2004
Location: India
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote manoj Quote  Post ReplyReply Direct Link To This Post Topic: Drag and Drop
    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  

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.