Why can’t you drop directly onto a taskbar button?

Raymond Chen

If you drag a object and drop it onto a taskbar button, you get an error message that says,

You cannot drop an item onto a button on the taskbar.

However, if you drag the item over a button without releasing the mouse button, the window will open after a moment, allowing you to drop the item inside the window.

Why doesn’t the taskbar let you drop directly onto a taskbar button?

Ideally, if the taskbar receives a IDropTarget::Drop, it could do something like this:

// imaginary code
IDropTarget *pdt;
if (SUCCEEDED(GetDropTargetFromWindow(hwndButton, &pdt))) {
  pdt->Drop(…);
  pdt->Release();
}

(Warning: I said “something like” this. Forwarding a drop is actually more complicated than this.)

The reason why the taskbar doesn’t do this is that there is no such function GetDropTargetFromWindow function. The taskbar can’t forward the drop operation even if it wanted to.

Why is there no GetDropTargetFromWindow function? I have no idea. You’ll have to ask the OLE folks. If I had to guess (and I know I have to because you folks will just keep badgering me until I come up with a guess), it’s because that would create the problem of how to prevent somebody from screwing with a program by grabbing its drop target and never releasing it.

Now of course people will criticize my explanation, so I’m going to say it again: I don’t know the answer. I’m just guessing. My guess is probably wrong.

0 comments

Discussion is closed.

Feedback usabilla icon