Example #1
0
        public static void RemoveMenu(IntPtr hWnd)
        {
            IntPtr menu          = WinAPI.GetMenu(hWnd);
            int    menuItemCount = WinAPI.GetMenuItemCount(menu);

            for (int i = 0; i < menuItemCount; i++)
            {
                WinAPI.RemoveMenu(menu, 0u, 5120u);
            }
            WinAPI.DrawMenuBar(hWnd);
        }
Example #2
0
        public static void DisableCloseButton(IntPtr hWnd)
        {
            IntPtr systemMenu = WinAPI.GetSystemMenu(hWnd, false);

            if (systemMenu != IntPtr.Zero)
            {
                int menuItemCount = WinAPI.GetMenuItemCount(systemMenu);
                if (menuItemCount > 0)
                {
                    WinAPI.RemoveMenu(systemMenu, (uint)(menuItemCount - 1), 5120u);
                    WinAPI.RemoveMenu(systemMenu, (uint)(menuItemCount - 2), 5120u);
                    WinAPI.DrawMenuBar(hWnd);
                }
            }
        }