Can you intercept messages when a dialog is dragged onto its controls?

If a dialog registers some of its controls as drop targets, drag'n'drop messages intended for those controls go through the dialog message processing in such a way that the dialog can register a message handler to be notified / intercepted by messages ?

Similar to this question, I want to catch drag'n'drop events at a higher level in certain circumstances, before calling the individual handlers. But do the answers to this question suggest that this is really impossible? How to disable drag and drop when opening a dialog box

+3


source to share


1 answer


If a dialog registers some of its controls as drop targets, drag'n'drop messages intended for those controls go through the dialog message processing in such a way that the dialog can register a message handler to be notified / intercepted by messages ?

If controls are used DragAcceptFiles()

, messages WM_DROPFILES

will go directly to the window procedures of the individual controls, rather than to the window procedure of the dialog. If you want to intercept messages, you will have to subclass the individual controls with SetWindowLongPtr()

or SetWindowSubClass()

or use the message hook from SetWindowsHookEx()

.

If controls are used RegisterDragDrop()

instead, drag and drop operations will not go through any window procedures at all, since OLE drag & drop does not use window messages.



Similar to this question, I want to catch drag'n'drop events at a higher level in certain circumstances, before calling the individual handlers. But do the answers to this question suggest that this is really impossible?

This is only possible with DragAcceptFiles()

and subclass / connect.

+2


source







All Articles