def ChangeMenuBarColor(self):
        """
        Changes the background color of the menubar and optionally gives 
        different colors to menu items
        """
        user32 = windll.user32
        DrawMenuBar = user32.DrawMenuBar
        GetMenu = user32.GetMenu
        GetSubMenu = user32.GetSubMenu
        GetSystemMenu = user32.GetSystemMenu
        SetMenuInfo = user32.SetMenuInfo
        GetMenuInfo = user32.GetMenuInfo
        gdi32 = windll.gdi32
        CreateSolidBrush = gdi32.CreateSolidBrush
        # Instantiate MENUINFO
        menuinfo = MENUINFO()
        # Important to set the size
        menuinfo.cbSize = sizeof(MENUINFO)
        menuinfo.fMask = win32con.MIM_BACKGROUND
        if not self.bShadeSubMenus:
            menuinfo.fMask |= win32con.MIM_APPLYTOSUBMENUS
        menuinfo.hbrBack = CreateSolidBrush(COLORREF(255, 0, 0))
        # Important! Pass *pointer* of the menuinfo instance to the win32 call
        SetMenuInfo(GetMenu(self.hwnd), pointer(menuinfo))
        if self.bShadeSubMenus:
            menuinfo.fMask = win32con.MIM_BACKGROUND | win32con.MIM_APPLYTOSUBMENUS
            menuinfo.hbrBack = CreateSolidBrush(COLORREF(255, 255, 0))
            SetMenuInfo(GetSubMenu(GetMenu(self.hwnd), 0), pointer(menuinfo))
            menuinfo.fMask = win32con.MIM_BACKGROUND | win32con.MIM_APPLYTOSUBMENUS
            menuinfo.hbrBack = CreateSolidBrush(COLORREF(128, 255, 128))
            SetMenuInfo(GetSubMenu(GetMenu(self.hwnd), 1), pointer(menuinfo))
        DrawMenuBar(self.hwnd)

        Changes the background color of the menubar and optionally gives 
        different colors to menu items
        
recipes/Python/440507_Changing_background_color_menu_bar/recipe-440507.py