Alrighty, here's a rough one...

The Gist:
I'm trying to create a popup menu that enumerates and loads the files in the recent documents menu that exist, and launch the file when clicked. The owner drawn menu is to display the associated icon (through ExtractAssociatedIcon).

What Works:
Then menus appear correctly with the appropriate icons.

What Doesn't:
When hovering over, I get a memory error.

What I Think:
WM_DRAWITEM works for the initial draw, hence everything looking good. When the item is selected, it sends to WM_DRAWITEM, which in turn calls a function to handle the drawing. I believe the problem occurs because I have the dynamic menu redrawn under the default switch for the itemID. The whole dynamic menu is redrawn because it cycles through every file.

The Question:
Short and Skinny, how can I load a directory's contents, with icons, into a menu, and still be able to click and launch?

Attached are the main.c, expand.h (menu loading functions), and resource.h.

If the full project would help, e-mail me and I'll zip it up. Thanks!