Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typical Win32 file drop (IDropTarget::Drop) implementation?

I am trying to make a Windows Explorer-like program in C++ without MFC.

It has a list view which shows the file system directories and files.

I want to add the drop target functionality for the list view,

so I implemented IDropTarget interface and registered the hwnd.

With IDropTargetHelper, I simply achieved the desired drag&drop effect in DragEnter, DragOver, DragLeave method.

But in Drop method, the dropTargetHelper was helpless.

My list view only accepts File drops.

Should I implement the dropped files' COPY, MOVE, LINK operation for myself?

OR is there a simple shell file operation helper which accepts dropped IDataObject?


EDIT:

I know how to get filenames from the dropped object, and just file copying is easy.

But I think maybe there are more things to consider: for example, making a file link, source item is virtual, and so on.

So I wonder if there are helper methods available from Windows shell.

like image 729
shkim Avatar asked Mar 01 '26 18:03

shkim


1 Answers

The textbook example would be the one from MSDN. Do read Old New Thing articles 1 and 2.

like image 175
MSalters Avatar answered Mar 03 '26 06:03

MSalters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!