Thank you for checking out my code, Doogle.

Quote Originally Posted by Doogle View Post
I tried the code attached to your Post.

Have you actually tried the demo code you posted ? (obviously not, since it doesn't compile ) Perhaps you should and see if it misbehaves for you or not.
I actually did. I used TrackPopupMenu to test something out when I first developed this demo application. I removed the API declaration from the code before posting to this board, but I forgot to take out the call to it. Since I was running the program without "full compile," I missed this.

I fixed the code and re-uploaded it. I edited my previous post to link to the new version.

It reported "6 submenu(s) in database. 0 menu(s) wont drop" at the bottom of the Form and each Menu and Sub-Menu item dropped OK all the time. Interestingly, I didn't get any output to the Immediate Window so there were no negative Handles returned from CreateMenu.
I'm actually not surprised you didn't experience any problems. I haven't either running this little demo program by itsself. My actual application uses the same APIs and database table structure, but of course, it is more complicated--having many more components to load, and the table of menu items has over 100 rows. That said, even my full application doesn't usually have problems with the menu on its first few executions from a clean Windows boot.

However, when I'm coding on the full application, it means I'm starting and stopping it many times, so eventually the menus start malfunctioning--all the menus will appear on the menu bar, but one or more menus (seemingly random) will not drop down when you click it. If it gets to this point, drop-down menus begin failing on the attached demo application, too! This is when you start seeing negative handle values.