Drag/drop files between explorer windows on windows 7

578 Views Asked by At

This is a kind of a complex query as it look it from outside. I would like to get notification about any drag/drop operation performed in windows explorer with exact number of files being dragged from source to target folder.

I have tried setwindowshookex in my application but the drag/drop events doesn't appears in callback function although I am getting resize, forgroundwindows, selection on items etc. events.

NOT sure what is wrong, it might seems impossible to Hook drag/drop events in windows.

Have anyone can help with this.

Thanks Al

1

There are 1 best solutions below

2
On

Drag&Drop operations inside of Windows Explorer do not use window messages, they use the IDropSource and IDropTarget COM interfaces via the DoDragDrop() function. You can't hook that with SetWindowsHookEx(). You would likely need to write some code into a DLL and inject it directly into Windows Explorer so it can then hook DoDragDrop() directly, such as with a detour, so any call to it will go through your hook code first. That way you can gain access to the COM interfaces that are passed to it, as well as detect whether the drag&drop was successful or canceled.