DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    _CAG Guest

    ModifyMenu doesn't work as I'd expect

    This appears to work (IDM_RESUME_GAME is the initial command). That is it
    changes the caption.

    ModifyMenu(hmenMenuBar,
    RESUME_MENU_POS, MF_BYPOSITION | MF_STRING, IDM_RESUME_GAME,
    "StartNew&Game");



    But if I try to change the command as follows I still get IDM_RESUME_GAME
    events instead of IDM_PAUSE events (the caption does change to Pause)

    ModifyMenu(hmenMenuBar,
    RESUME_MENU_POS, MF_BYPOSITION | MF_STRING, IDM_PAUSE,
    "&Pause");

    What am I doing wrong?


    Thanks,
    Cal





  2. #2
    Manoj Guest

    Re: ModifyMenu doesn't work as I'd expect


    Hi,

    You can use SetMenuItemInfo function, in place of the ModifyMenu function.

    If you still want to use ModifyMenu, read this...

    If ModifyMenu replaces a menu item that opens a drop-down menu or submenu,
    the function destroys the old drop-down menu or submenu and frees the memory
    used by it.

    In order for keyboard accelerators to work with bitmap or owner-drawn menu
    items, the owner of the menu must process the WM_MENUCHAR message. See Owner-Drawn
    Menus and the WM_MENUCHAR Message for more information.

    The application must call the DrawMenuBar function whenever a menu changes,
    whether or not the menu is in a displayed window. To change the attributes
    of existing menu items, it is much faster to use the CheckMenuItem and EnableMenuItem
    functions.


    Hope this helps.

    Bye.

    "_CAG" <CAG@a-znet.com> wrote:
    >This appears to work (IDM_RESUME_GAME is the initial command). That is it
    >changes the caption.
    >
    >ModifyMenu(hmenMenuBar,
    > RESUME_MENU_POS, MF_BYPOSITION | MF_STRING, IDM_RESUME_GAME,
    > "StartNew&Game");
    >
    >
    >
    >But if I try to change the command as follows I still get IDM_RESUME_GAME
    >events instead of IDM_PAUSE events (the caption does change to Pause)
    >
    >ModifyMenu(hmenMenuBar,
    > RESUME_MENU_POS, MF_BYPOSITION | MF_STRING, IDM_PAUSE,
    > "&Pause");
    >
    >What am I doing wrong?
    >
    >
    >Thanks,
    >Cal
    >
    >
    >
    >



  3. #3
    _CAG Guest

    Re: ModifyMenu doesn't work as I'd expect

    Thqanks,
    Cal
    "Manoj" <mansin2001@rediffmail.com> wrote in message
    news:3c7a0182$1@10.1.10.29...
    >
    > Hi,
    >
    > You can use SetMenuItemInfo function, in place of the ModifyMenu function.
    >
    > If you still want to use ModifyMenu, read this...
    >
    > If ModifyMenu replaces a menu item that opens a drop-down menu or submenu,
    > the function destroys the old drop-down menu or submenu and frees the

    memory
    > used by it.
    >
    > In order for keyboard accelerators to work with bitmap or owner-drawn menu
    > items, the owner of the menu must process the WM_MENUCHAR message. See

    Owner-Drawn
    > Menus and the WM_MENUCHAR Message for more information.
    >
    > The application must call the DrawMenuBar function whenever a menu

    changes,
    > whether or not the menu is in a displayed window. To change the attributes
    > of existing menu items, it is much faster to use the CheckMenuItem and

    EnableMenuItem
    > functions.
    >
    >
    > Hope this helps.
    >
    > Bye.
    >
    > "_CAG" <CAG@a-znet.com> wrote:
    > >This appears to work (IDM_RESUME_GAME is the initial command). That is it
    > >changes the caption.
    > >
    > >ModifyMenu(hmenMenuBar,
    > > RESUME_MENU_POS, MF_BYPOSITION | MF_STRING, IDM_RESUME_GAME,
    > > "StartNew&Game");
    > >
    > >
    > >
    > >But if I try to change the command as follows I still get IDM_RESUME_GAME
    > >events instead of IDM_PAUSE events (the caption does change to Pause)
    > >
    > >ModifyMenu(hmenMenuBar,
    > > RESUME_MENU_POS, MF_BYPOSITION | MF_STRING, IDM_PAUSE,
    > > "&Pause");
    > >
    > >What am I doing wrong?
    > >
    > >
    > >Thanks,
    > >Cal
    > >
    > >
    > >
    > >

    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links