How drag and drop of files is done?

后端 未结 6 1733
刺人心
刺人心 2021-01-13 07:29

as in winamp or vlc player, how to do a file drag and drop? i mean i want to know what sort of coding goes into application? i want to know for c++

6条回答
  •  失恋的感觉
    2021-01-13 08:14

    Before the days of OLE/COM/ActiveX, we would do something like the following:

    • If we received a mouse down event, take note of cursor position.
    • If we received a mouse movement and it moved a certain distance from the original point then we're starting a drag operation. Build a cursor that represents the object you're dragging (determined from the original cursor position).
    • When we received a mouse down: if dragging never started then it's a click otherwise use the drop position to determine what to do with the object.

    Note: none of this would allow you to drag objects between apps, just inside individual apps.

提交回复
热议问题