GetMenuBarInfo

[DllImport("user32.dll")]
public static extern bool GetMenuBarInfo(
   IntPtr hwnd,
   long idObject,
   long idItem,
   ref MENUBARINFO pmbi
);

Microsoft documentation: Link

Last updated