May 14th, 2021

Why isn’t my shell namespace extension getting every single DragOver mouse message?

A customer had a shell namespace extension and discovered that when the user dragged an item, their custom drop target gets Drag­Enter and Drag­Leave method calls as expected, but the Drag­Over method calls are being throttled. Specifically, they get a new Drag­Over call only if the keyboard modifier state changes. How can they get a Drag­Over call for every mouse move?

Explorer calls the shell extension when significant events occur, such as the user dragging over a different item, but it doesn’t call out for insignificant events, like the mouse moving one pixel.

The customer explained that they found that the default drag feedback for shell extensions doesn’t match the default drag feedback used by Explorer. In particular, the little information box that says “Copy to…” or “Move to…” is missing. The customer wrote their own information box window to show that information, so they need the precise mouse location information so they can position the information box properly.

Oh, if it’s the information box you’re after, then you could have just asked for the information box. (Another case of an XY problem.)

Explorer uses the shell drag/drop helper, so you can use the Set­Drop­Description function we wrote last time. That will put the information box next to the drag image in exactly the same way that Explorer does. (Because this is the same method that Explorer itself uses to put information into the info box.)

The customer was kind enough to write back. “It works perfectly.”

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Neil Rashbrook

    Could the customer, left to their own devices, have registered each pixel as a separate item in order to get the effect they were expecting?