What Could Explain This Odd "Automatic Save" Behavior of Notepad?

Solution 1:

No, there's no magic content recognition here. You're actually not dragging any content into Notepad to paste it – you're dragging an actual file into Notepad to open it. So it is not automatically saving anything but opening a file that has already been saved previously.

It sounds like your program deliberately sets up its drag source to offer a "shell object" (and not just the plain MIDI data). When you drop it into Notepad, it looks at the data types provided through the "drag source", and if it sees that it's being offered a file, it opens that file.

(In fact, I don't think Notepad even accepts text being dragged into it? Other editors commonly allow that, but the standard Windows Notepad actually does not.)

This means that you should also be able to drag the same sequence directly to a folder and I expect that Explorer would recognize this as a file copy.


You can also try dropping it into WordPad or Microsoft Word. If you drop something onto WordPad's title bar/button bar it'll be opened as a file; but if you drop it into the "document" area it'll get inserted either as text or as an OLE object, so you can see exactly what you were dragging.