Something about CMenu
2009-09-04 20:04
260 查看
VOID setWindowOnMenuTopMost(HWND hWnd, int iMenu, int iPos) { HMENU hMenu = GetMenu(hWnd); HMENU hSubMenu = GetSubMenu(hMenu, iMenu); UINT uID = GetMenuItemID(hSubMenu, iPos); ASSERT( uID != -1 ); MENUITEMINFO miiTopMost; // ZeroMemory is necessary ZeroMemory(&miiTopMost, sizeof miiTopMost); // fMask: Members to retrieve or set.if you want to modify fState member, just evaluate fMark member with MIIMSTATE // The same to other members, fMask can be one or more values. miiTopMost.fMask = MIIM_STATE; // Fill cbSize member is necessary miiTopMost.cbSize = sizeof MENUITEMINFO; // Fill MENUITEMINFO menu item information;TRUE: menu item posation, FALSE: menu item ID. BOOL bRes = GetMenuItemInfo(hSubMenu, uID, FALSE, &miiTopMost); ASSERT( bRes ); if( miiTopMost.fState == MFS_CHECKED ) { // Set window no topmost, update menu information and redraw menu SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); miiTopMost.fState = MFS_UNCHECKED; SetMenuItemInfo(hSubMenu, uID, FALSE, &miiTopMost); DrawMenuBar(hWnd); } else { // Set window topmost, update menu information and redraw menu SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); miiTopMost.fState = MFS_CHECKED; SetMenuItemInfo(hSubMenu, uID, FALSE, &miiTopMost); DrawMenuBar(hWnd); } return ; }
该函数实现功能:就是一般程序通过菜单选项选择总显示在最前端功能。
相关文章推荐
- something about Solaris
- Something about overloaded
- some website about something or other persons
- something about Compile and Link on Embedded Linux
- Something about PC Terminal retail industry !
- SOMETHING ABOUT MENTAL MODEL
- Something about Vim
- something about Android activity
- 字符、字符集、编码——Something Every Programmer Should Know About
- something about set the FSDB file
- Something about how install Eclipse onto Ubuntu14.04
- something about facebook token
- something about SEO
- something about this week
- Something about Perl (4) 流程控制
- Start to learn something about "Atlas"
- something about table
- Something I know about WebDynpro
- Something About USB On-The-Go
- Something about Assembly language 1