I created a menu in a dialog using CMenu.

When we click a button or the mouse over a button in the menu, the submenu will appear.

Then how can i know the submenu is appeared and close the appeared submenu in my dialog.