1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
HMENU hPopupMenu = CreatePopupMenu();
HMENU hSubMenuGame=CreatePopupMenu(); // Create submenu for Game
HMENU hSubMenuPlay=CreatePopupMenu(); // submenu for 'play'
// Add items to submenus
InsertMenu(hSubMenuPlay, 0, MF_BYPOSITION | MF_STRING,ID_IDX, _T("Start"));
InsertMenu(hSubMenuPlay, 0, MF_BYPOSITION | MF_STRING, ID_IDY, _T("Stop"));
InsertMenu(hSubMenuGame, 0, MF_BYPOSITION | MF_STRING,ID_GAME_START, _T("Start"));
InsertMenu(hSubMenuGame, 0, MF_BYPOSITION | MF_STRING, ID_GAME_STOP, _T("Stop"));
//Append submenu 'play' to popup menu
AppendMenu(hPopupMenu,MF_POPUP | MF_STRING,(UINT)hSubMenuGame,_T("Game"));
//Append menu item 'exit'
AppendMenu(hPopupMenu, MF_BYPOSITION | MF_STRING, 1245, _T("Exit"));
// Append submenu 'play'
AppendMenu(hPopupMenu,MF_POPUP | MF_STRING,(UINT)hSubMenuGame,_T("Play"));
SetForegroundWindow(hwndDlg);
TrackPopupMenu(hPopupMenu, TPM_BOTTOMALIGN | TPM_LEFTALIGN, 0, 0, 0, hwndDlg, NULL);
|