Hi Charles,
this is cool! (perhaps). I gave up the idea to use LoadMenuIndirect and used instead CreateMenu, Appendmenu with a macro and some helper functions. I used this .rc file as an example:
1 MENU
BEGIN
POPUP "&File"
BEGIN
POPUP "&New"
BEGIN
MENUITEM "&Empty file",1100
POPUP "By template &file..."
BEGIN
MENUITEM "Template 1",1102,CHECKED
MENUITEM "Template 2",1103
MENUITEM "Template 3",1104
END
MENUITEM SEPARATOR
MENUITEM "Empty &window",1105
END
MENUITEM "&Open...\tCtrl+O",1110
MENUITEM "&Save\tCtrl+S",1111
MENUITEM "Save &as...\tF12",1112
MENUITEM SEPARATOR
MENUITEM "E&xit\tAlt+F4",1180
END
POPUP "&Edit"
BEGIN
MENUITEM "U&ndo\tCtrl+Z",1200,GRAYED
MENUITEM SEPARATOR
MENUITEM "&Cut\tCtrl+X",1201,GRAYED
MENUITEM "C&opy\tCtrl+C",1202,GRAYED
MENUITEM "&Paste\tCtrl+V",1203
MENUITEM SEPARATOR
MENUITEM "Select &all\tCtrl+A",1204
END
MENUITEM "&Compile!",1301
MENUITEM "&Run!",1302
POPUP "&Tools"
BEGIN
MENUITEM "&Compile\tF5",1301
MENUITEM "&Run\tF6",1302
MENUITEM SEPARATOR
MENUITEM "&Edit Resources\tF7",1311
MENUITEM SEPARATOR
MENUITEM "Code &formatter...",1321
END
POPUP "&Options"
BEGIN
MENUITEM "&Font settings...",1401
MENUITEM "&General settings...",1402
MENUITEM "&Project settings...",1403
MENUITEM SEPARATOR
MENUITEM "Auto &indent",1411
END
POPUP "&Help"
BEGIN
MENUITEM "Help &keyword...\tF1",1900
MENUITEM "&Basic help\tShift+F1",1901
MENUITEM "&API help\tAlt+F1",1902
MENUITEM "&Editor help\tCtrl+F1",1903
MENUITEM SEPARATOR
MENUITEM "Ab&out",1909
END
END
After replacing (using dyn):
MENU with:
sys hMenu
MENU(hMenu)
\t with: " tab "
SEPARATOR with "SEPARATOR"
END with ENDMenu
I will get this result:
'1 MENU
sys hMenu
dyn::MENU(hMenu)
dyn::BEGIN
dyn::POPUP "&File"
dyn::BEGIN
dyn::POPUP "&New"
dyn::BEGIN
dyn::MENUITEM "&Empty file",1100
dyn::POPUP "By template &file..."
dyn::BEGIN
dyn::MENUITEM "Template 1",1102,CHECKED
dyn::MENUITEM "Template 2",1103
dyn::MENUITEM "Template 3",1104
dyn::ENDMenu
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "Empty &window",1105
dyn::ENDMenu
dyn::MENUITEM "&Open..." tab "Ctrl+O",1110
dyn::MENUITEM "&Save" tab "Ctrl+S",1111
dyn::MENUITEM "Save &as..." tab "F12",1112
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "E&xit" tab "Alt+F4",1180
dyn::ENDMenu
dyn::POPUP "&Edit"
dyn::BEGIN
dyn::MENUITEM "U&ndo" tab "Ctrl+Z",1200,GRAYED
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "&Cut" tab "Ctrl+X",1201,GRAYED
dyn::MENUITEM "C&opy" tab "Ctrl+C",1202,GRAYED
dyn::MENUITEM "&Paste" tab "Ctrl+V",1203
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "Select &all" tab "Ctrl+A",1204
dyn::ENDMenu
dyn::MENUITEM "&Compile!",1301
dyn::MENUITEM "&Run!",1302
dyn::POPUP "&Tools"
dyn::BEGIN
dyn::MENUITEM "&Compile" tab "F5",1301
dyn::MENUITEM "&Run" tab "F6",1302
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "&Edit Resources" tab "F7",1311
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "Code &formatter...",1321
dyn::ENDMenu
dyn::POPUP "&Options"
dyn::BEGIN
dyn::MENUITEM "&Font settings...",1401
dyn::MENUITEM "&General settings...",1402
dyn::MENUITEM "&Project settings...",1403
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "Auto &indent",1411
dyn::ENDMenu
dyn::POPUP "&Help"
dyn::BEGIN
dyn::MENUITEM "Help &keyword..." tab "F1",1900
dyn::MENUITEM "&Basic help" tab "Shift+F1",1901
dyn::MENUITEM "&API help" tab "Alt+F1",1902
dyn::MENUITEM "&Editor help" tab "Ctrl+F1",1903
dyn::MENUITEM "SEPARATOR"
dyn::MENUITEM "Ab&out",1909
dyn::ENDMenu
dyn::ENDMenu
In theory I can create a menu with 9 levels of submenus (which is nonsense). But I am surprised that it seems to be so easy to achieve this with OxygenBasic.
Attached is the enhanced dialogs.inc file and the Menu example. As you are a lot smarter than me maybe you will check the code of the helper functions for possible weaknesses? It would be great if the functions would be useable.
My next step will be to explore accelerators.
Roland
[attachment deleted by admin]