@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: This function appends a new item to the end of the specified menu. You can use AppendMenu to specify the content, appearance, and behavior of the menu item. !!!!C# Signature: [DllImport("coredll.dll")] static extern uint AppendMenu(IntPtr hMenu, uint uFlags, uint uIDNewItem, string lpNewItem); !!!!User-Defined Types: ''[uFlags]'' uint MF_BYCOMMAND = 0x00000000; uint MF_BYPOSITION = 0x00000400; uint MF_SEPARATOR = 0x00000800; uint MF_ENABLED = 0x00000000; uint MF_GRAYED = 0x00000001; uint MF_UNCHECKED = 0x00000000; uint MF_CHECKED = 0x00000008; uint MF_STRING = 0x00000000; uint MF_OWNERDRAW = 0x00000100; uint MF_POPUP = 0x00000010; !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: None. !!!!Tips & Tricks: To add a submenu use MF_STRING in conjunction with MF_POPUP passing to the ''[uIDNewItem]'' parameter the handle to the submenu parent item as illustrated in the '''Sample Code''' section. !!!!Sample Code: [DllImport("coredll.dll")] static extern IntPtr CreatePopupMenu(); [DllImport("coredll.dll")] static extern uint AppendMenu(IntPtr hMenu, uint uFlags, uint uIDNewItem, string lpNewItem); const uint MF_STRING = 0x00000000; const uint MF_POPUP = 0x00000010; public void CreateMenu() { IntPtr hMenu = CreatePopupMenu(); uint flags = MF_STRING; AppendMenu(hMenu, flags, 1001, "Simple Menu Item"); IntPtr subMenuParentItem = CreatePopupMenu(); flags |= MF_POPUP; AppendMenu(hMenu, flags, (uint) subMenuParentItem, "Pop-up Parent Item"); AppendMenu(subMenuParentItem, MF_STRING, 1010, "Submenu Simple Item"); } Documentation: AppendMenu@msdn on MSDN
Edit coredll.AppendMenu
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.