gpt4 book ai didi

c++ - 将子菜单项添加到菜单项

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:50:59 24 4
gpt4 key购买 nike

我在用 C++ 将子菜单项添加到我的窗口菜单时遇到了问题。我为我的游戏添加了一定数量(准确地说是 20 个)的保存位置。

这是我的保存槽代码:

    HMENU win32MENU = CreateMenu();//Menu bar

HMENU win32SETTINGS = CreateMenu();//Settings option
HMENU win32SAVESLOTS = CreateMenu();//Save Slots

AppendMenu(win32MENU,MF_POPUP,(UINT_PTR)win32SETTINGS,"Settings");

//Settings
AppendMenu(win32SETTINGS,MF_STRING,(UINT_PTR)win32SAVESLOTS,"Save Ctrl+S");

//Save Slots
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Default ~");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 1");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 2");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 3");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 4");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 5");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 6");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 7");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 8");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 9");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 10");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 11");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 12");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 13");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 14");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 15");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 16");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 17");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 18");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 19");
AppendMenu(win32SAVESLOTS,MF_STRING,NULL,"Save Slot 20");

提前致谢。

最佳答案

改变:

AppendMenu(win32SETTINGS,MF_STRING,(UINT_PTR)win32SAVESLOTS,"保存 Ctrl+S");

AppendMenu(win32SETTINGS,MF_STRING | MF_POPUP,(UINT_PTR)win32SAVESLOTS,"保存 Ctrl+S");

另外,改变


HMENU win32SAVESLOTS = CreateMenu();//保存槽


HMENU win32SAVESLOTS = CreatePopupMenu();//保存槽

关于c++ - 将子菜单项添加到菜单项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15979824/

24 4 0