views:

321

answers:

1

I have a basic app written with ATL, using the wizard with VS2008. I have a treeview in the left side of the app. I see how to (painfully) add tree items. Question is how do I show a menu when the mouse is right clicked? How do I trap any click events on each item that could be selected?

+1  A: 

You should detect the WM_CONTEXTMENU windows message by specifying a handler in your message map. In the handler you can then show the context menu. You then need to make sure you also handle the menu commands in your message map for when a command is selected from the context menu. Use the COMMAND_HANDLER macro in your message map for this part.

Jeff Yates