my image class can read animated gif's. using a timer i can change the menu item image. but when the menu item is showed, how can i refresh it?
(i have tryied the DrawMenuBar() and SetMenu() without sucess. the image is, only, updated when i move the mouse from 1 item to another one)

when we move the moouse by items a nice rectangle is showed where is the mouse and hided on last menu item. when these happens the menu item is updated. knowing these i came up with 1 nice ideia ;)

void Refresh()
    {
        HMENU hMenu = NULL;
        if(primeiromenu)
            hMenu = mnuBar;
        else
            hMenu = MenuHandle;
        bool IsHighlith=false;
        if(GetMenuState(hMenu,ID,MF_BYCOMMAND)==MF_HILITE)
            IsHighlith=true;
        MENUITEMINFO  s={0};
        s.cbSize=sizeof(MENUITEMINFO );
        s.fMask=MIIM_STATE;
        GetMenuItemInfo (hMenu,ID, FALSE, &s);
        if(IsHighlith==true)
            s.fState|=MFS_HILITE;
        else
            s.fState|=MFS_UNHILITE;
        SetMenuItemInfo (hMenu,ID, FALSE, &s);

        if(IsHighlith==true)
        {
            s={0};//empty the 's' for don't have a garbage data
            s.fMask=MIIM_STATE;
            GetMenuItemInfo (hMenu,ID, FALSE, &s);
            s.fState|=MFS_HILITE;
            SetMenuItemInfo (hMenu,ID, FALSE, &s);
        }
    }

now i can refresh a menu item ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.