winapi - Getting the width of the icon area of a context menu -


i need width of icon area of context menu using windows api (>= windows xp if matters). mean icon area can see in this question, there image. space reserved icons on left side of menu.

i scanned through wealth of information can via systemparametersinfo , getsystemmetrics, found nothing. there has default value, right? how it?

a native win32 menu not support icons can't call icon area. in basic menu size of area sm_cxmenucheck wide (plus sm_cxedge padding probably) vista+ might able find better metrics menu_popup* constants , getthemeint. afaik exact layout , border constants required replicate classic win95+ menus not documented.

since talking icons assume want add icons menu width should max(youriconwidth,getsystemmetrics(sm_cxmenucheck)) + padding. this old msj article best menu owner draw tutorial out there, , codeproject has own menu article section several different owner draw implementations. (ms office , visual studio use custom stuff well)

as final note, since said xp+ should able use hbmmenu_callback , worry icon , not rest of menu drawing...


Comments