Native Win32 C++ OLE Drag Multiple Listview items (not files)

NorthernSun 101 Reputation points
2021-04-28T17:59:53.773+00:00

I have two Listviews in my application that will be able to drag&drop items to each other. The Listview items are not files, but they are simply items created from database data. The items do have a bitmap and a text and (potentially) sub-items. I am trying to use OLE to drag multiple items at once, but so far I am only able to drag one item at a time. Currently I use a custom FORMATETC flag created with RegisterClipboardFormat() and TYMED_GLOBAL. I made a custom class that contains all the to-be-dragged item info and I put that class into STGMEDIUM.hGlobal. That works for one item, but I don't know how I can make this work for when I drag multiple items. Does anyone have a suggestion? Thanks in advance!

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,426 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,537 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. RLWA32 40,571 Reputation points
    2021-04-29T00:42:36.493+00:00

    When you add the information about the individual items to be transferred to the data object you could also add information that indicates how many data items are included in the transfer. For example, take a look at the documentation for Shell data transfer. It uses one format to indicate how many files are included in the transfer and another format for the actual data to be transferred.

    1 person found this answer helpful.