2

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");

前もって感謝します。

4

1 に答える 1

2

変化する:

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

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

また、変更

HMENU win32SAVESLOTS = CreateMenu();//Save Slots

HMENU win32SAVESLOTS = CreatePopupMenu();//Save Slots

于 2013-04-12T20:20:48.440 に答える