No, really, you need to pass all unhandled messages to DefWindowProc, part 2
cppdashboard.dev/r/2026/09/no-really-you-need-to-pass-all-unhandled-messages-to-defwindThis article discusses a reported memory leak in Windows related to the RegisterDragDrop and RevokeDragDrop calls. It emphasizes the importance of passing unhandled messages to DefWindowProc to ensure proper cleanup.
From the article
A customer reported a memory leak in Windows that occurred when they called RegisterDragDrop followed by RevokeDragDrop . They included a time travel trace of a sample program that demonstrated the problem. (Though for some reason, they didn’t include the program itself; just the time travel trace.)
Now, it is strange that there would be a memory leak if you call RegisterDragDrop followed by RevokeDragDrop , seeing as this pattern is used heavily by thousands of applications, including many parts of Windows itself, so if there were a memory leak inherent in the pattern, you’d think it’d have been reported by now.
I suspected that there was something special about their sample program.
Share this resource