How to create a drop down menu in MFC for WINCE
Posted
by ame
on Stack Overflow
See other posts from Stack Overflow
or by ame
Published on 2010-04-28T05:20:56Z
Indexed on
2010/04/28
5:23 UTC
Read the original article
Hit count: 388
I have tried the following code in a win32 app that shows a drop down menu on clicking a button. However, this does not work in WinCE as MENUINFO is not defined. Is there any way I can get around this? I need to view a drop down menu on clicking a button, and the name appearing on the button changes depending on the option on the menu.
void CTestDlg::OnBnClickedBtnMenu()
{
if( NULL == m_PopUpMenu.m_hMenu )
{
m_PopUpMenu.SetMenuDimension( 120 );
m_PopUpMenu.CreatePopupMenu();
m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("A") );
m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("B") );
m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("C") );
m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("D") );
MENUINFO MenuInfo;
memset( &MenuInfo, 0, sizeof(MENUINFO) );
MenuInfo.cbSize = sizeof(MENUINFO);
MenuInfo.fMask = MIM_STYLE;
MenuInfo.dwStyle = MNS_NOTIFYBYPOS;
m_PopUpMenu.SetMenuInfo( &MenuInfo );
}
© Stack Overflow or respective owner