I've tried giving an ID to a menu popup in my resource file, but it never seems to work. I'm trying to come up with a way to automate something I do repeatedly with different parts of the menu. I'll post some source below with a comment as to what I'm wanting to accomplish.
p.s. Why can't you use control styles like LVS_EX_GRIDLINES in the damn resource file instead of having to SendMessage LVM_SETEXTENDEDLISTVIEWSTYLE them?
Code://This is a piece of the menu as an example... RENEGADE_MNU MENU BEGIN POPUP "File" BEGIN MENUITEM "Exit",MNU_EXIT END POPUP "Search" BEGIN POPUP "Input Type" BEGIN MENUITEM "Hexadecimal",MNU_CS_INPUT_HEX MENUITEM "Decimal",MNU_CS_INPUT_DEC MENUITEM "Float/Double",MNU_CS_INPUT_FLOAT END MENUITEM "Load Search",MNU_CS_LOAD_SEARCH MENUITEM "Undo Last Search",MNU_CS_UNDO END END //then within the message loop at WM_COMMAND //Notice how I have to uncheck them all a line at a time. If I could grab the popup, //I should be able to call a little function to loop and uncheck them for less clutter in my source. case MNU_CS_INPUT_HEX: case MNU_CS_INPUT_DEC: case MNU_CS_INPUT_FLOAT: { Settings.CS.NumBase = GetMenuItemData(hMenu, LOWORD(wParam)); Settings.CS.NumBaseId = LOWORD(wParam); SetMenuState(hMenu, MNU_CS_INPUT_HEX, MFS_UNCHECKED); SetMenuState(hMenu, MNU_CS_INPUT_DEC, MFS_UNCHECKED); SetMenuState(hMenu, MNU_CS_INPUT_FLOAT, MFS_UNCHECKED); SetMenuState(hMenu, LOWORD(wParam), MFS_CHECKED); } break; //SetMenuState does exactly what it sounds like. It's a wrapper for the standard SetMenuInfo function //I didn't want to spend 5 lines doing that all the time either. int SetMenuState(HMENU hMenu, UINT id, UINT state) { MENUITEMINFO mnuItem; memset(&mnuItem,0,sizeof(mnuItem)); mnuItem.cbSize = sizeof(MENUITEMINFO); mnuItem.fMask = MIIM_STATE; mnuItem.fState = state; return SetMenuItemInfo(hMenu, id, FALSE, &mnuItem); }



LinkBack URL
About LinkBacks




