Hi all. I have a question related to MFC application: is it possible for an MFC application to receive "select" or "WM_COMMAND" event for MENUITEM separator?
MY OBJECTIVE: when a user performs right-click in the program, a pop-up menu is created with an "auto-hide" functionality. Meaning: the pop-up menu stays when the mouse is inside the menu or submenu or subsubmenu. And it disappears when the mouse is not in one of the menu (outside the popup menu). Current implementation works fine when we create menu and submenu (without MENUITEM SEPARATOR).
PROBLEM: When there are separators inside the pop-up menu, MFC/Windows does not deal with the separator (we can't assign event or ID to it), and hence the pop-up menu will disappear each time the menu navigates on the separator as it was triggered.
Does anyone has a solution to this problem? Maybe there are alternative ways to implement this.
Example of my resource file is summarized below:
IDR_POPUP_MN MENU DISCARDABLE
BEGIN
POPUP "_POPUP"
BEGIN
MENUITEM "Menu A", ID_A
MENUITEM "Menu B", ID_B
MENUITEM SEPARATOR
POPUP "Menu C"
BEGIN
MENUITEM "Menu C-1", ID_C1
MENUITEM SEPARATOR
POPUP "Menu C-2"
BEGIN
MENUITEM "Menu C-2-1", ID_C21
MENUITEM "Menu C-2-2", ID_C12
END
MENUITEM SEPARATOR
MENUITEM "Menu C-3", ID_C3
END
MENUITEM "Menu D", ID_D
END
END
Similarly, the same technique should apply also for menubar.
Thanks in advance. Wilson