CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Drag&Drop CListBox

    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?


  2. #2
    Guest

    Re: Drag&Drop CListBox

    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".


  3. #3
    Guest

    try setcapture()

    this function redirects all mouse movements to the currently selected control until youy release it


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured