For what it's worth... to anyone else who runs into this problem...
This issue is when I try to access the submenus using MF_BYPOSITION. The cause of this problem is that when any MDI child window was created, I do NOT have the icon to the left of the "File" menu. However, one I open a 2nd child window and navigate between the 2... now both documents have the icon to the left of the "File" menu.
This icon is what allows me to select things like minimize, maximize and move.
By putting in a simple line to check to see if submenu #0 has a string value or is an icon, I know if I need to treat the "File" menu as submenu #0 or #1.
Easy fix, hard to find.
int nOffset = 0;
GetMenuString(0, szTemp, MF_BYPOSITION);
CMenu* pSubMenu = GetSubMenu(0 + nOffset); // this should ALWAYS get me to the "File" menu
This way is not good.
1. you should check whether the child window is maximized (then the first menu item is an "icon") or not.
2. You should not hard code the menu item strings, i.e. you should not expect that the first menu would be "File", the second - "Edit" and so on. The better way - to find the menu that corresponds to "File" using some menu item IDs that are always included in that menu (like ID_FILE_OPEN, ID_FILE_CLOSE and so on). A good example is the MFC CMDIFrameWnd::GetWindowMenuPopup method.
I do see the merit in what you are suggesting, but in my case - the menu arrangement is static. I don't need to worry about the "File" menu being 1st or 3rd. My only requirement is that I'm doing a real-time substitution of text in the menu dependent on the operator specific language. So using code that returns the location of the "File" menu as 1 doesn't really help me any more than knowing that it is in location 0 + 1 if the item in location 0 has a string length of 0.
And in terms of sub-menus, this solution would not work if the only items in a sub-menu are also sub-menus. Granted... once you know the index location of "File", the sub-menu of sub-menu issue is irrelevant because you know have the index of that original sub-menu from doing the lookup function.
Anyway... for my purposes, this option is more than what I need... but thank you for your suggestions.