I used your code to show popup menu on right click on a list control. The handlers for the menu commands were not at all called.
Then I tried with TPM_RETURNCMD value commented in TrackPopupMenu() function and it worked from then.
I dont know how this fixed though.
The one part of the microsoft's example that they leave out is how to get the current cursor position. When you use the list control window for a pop-up menu, the message handler does not give you the mouse co-ordinates(very odd that the C++ team decided to do this). I had forgotton about the GetCurPos function- that solved the problem. Again Thanks!
I used the conventional menu which contained a very large list of items. For some reasone the menu sent me the wrong item command - only on the items last items on the list. It looks like it mis-calculated the items height and sent the above item command.
This method fix the problem.