Click to See Complete Forum and Search --> : Drag&Drop CListBox


May 22nd, 1999, 01:58 PM
When I use the LButtonDown for Drag and Drop, The control never recieves a ButtonUp. I made a class from a CListBox, and my code looks like this:

void ListBox::OnLButtonDown(UINT nFlags, CPoint point)
{
COleDataSource* pSource = new COleDataSource();
CSharedFile sf(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT);
CString text = _T("Testing 1... 2... 3...");

sf.Write(text, text.GetLength()); // You can write to the clipboard as you would to any CFile

HGLOBAL hMem = sf.Detach();
if (!hMem) return;
pSource->CacheGlobalData(CF_TEXT, hMem);
pSource->DoDragDrop();

CListBox::OnLButtonDown(nFlags, point);
}

What am I doing wrong?

May 22nd, 1999, 08:53 PM
Why you want recevie the WM_LBUTTONUP ?
You can do what you want after the DoDragDrop return.
There is a more detail example in MSDN. Search "Lstdrg.exe".

May 25th, 1999, 06:41 AM
this function redirects all mouse movements to the currently selected control until youy release it