CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    8

    Repaint Items in OwnerDraw Menu

    Hello people,

    ok i have a big problem. I wil redraw my OwnerDraw Menu every second. So i wrote a Timerproc and start it with SetTimer:
    Here are my TimerProc:
    void CALLBACK TimerProc(HWND hWnd,UINT nMsg,UINT nIDEvent,DWORD dwTime)
    {
    count++;
    DrawMenuBar(AfxGetMainWnd()->GetSafeHwnd());
    }
    But it doesn't redraw the MenuItems. The header will redraw but not the Items. Why????

    Sorry for my bad english

  2. #2
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: Repaint Items in OwnerDraw Menu

    The menu bar is a different window to the actual menu being displayed.

    If you need a menu to re-drawn then you will have to hook the creation of the menu window (look for WM_CREATE and and window class of #32768). This will give you the HWND of the menu, which you should be able to call Invalidate() on.

    There is no known method to go from HMENU to HWND (or visa-versa - I know - I spent a week researching it), so hooking the window creation is the only method I know whcih would work for you.

    Some issues may be that there are several class names used for window used by menus. #32768 is the most common, but there are others
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

  3. #3
    Join Date
    Feb 2005
    Location
    Pune (India)
    Posts
    644

    Thumbs up Re: Repaint Items in OwnerDraw Menu

    Hi XYZ44
    I am looking for sample of OwnerDraw Menu.
    Will you help me by sending Sample application demostrating Drawing menu and its subitem , Either in Win32 Sdk or Mfc.


    Thanks in Advance
    Anant

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured