How to implement owner draw menu in smart device?

I create a smart device project, and add some code like

SHMENUBARINFO mbi;

memset(&mbi, 0, sizeof(SHMENUBARINFO));
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hWnd;
mbi.dwFlags |= SHCMBF_HMENU | SHCMBF_COLORBK;
mbi.nToolBarId = IDR_MAIN_MENU;
mbi.hInstRes = g_hInst;
mbi.clrBk = RGB(255, 0, 0);

if (!SHCreateMenuBar(&mbi))
{
g_hWndMenuBar = NULL;
}
else
{
HMENU hMenu = (HMENU)::SendMessage(mbi.hwndMB, SHCMBM_GETMENU, 0, 0);
MENUITEMINFO mii;
memset((char *)&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
LRESULT lResult = 0;

UINT i = 0;

while(true)
{
if(0 == ::GetMenuItemInfo(hMenu, i, TRUE, &mii))
{
break;
}
mii.fType |= MFT_OWNERDRAW;
lResult = ::SetMenuItemInfo(hMenu, i, TRUE, &mii);
++i;
}

g_hWndMenuBar = mbi.hwndMB;
}

But I can not receive WM_MEASUREITEM and WM_DRAWITEM. What is wrong



Answer this question

How to implement owner draw menu in smart device?

  • NeederOfVBHelp

    Does not support owner draw menu item in windows CE
  • How to implement owner draw menu in smart device?