CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Location
    India
    Posts
    215

    Exclamation How to Disable a Menu Item In Win32 SDK

    Hi,

    Can anybody tell me how to disable a menu item in Win32 SDK environment.
    I am working on "Windows Mobile 5.0 Smartphone".

    Regards
    Sudha

  2. #2
    Join Date
    Jan 2003
    Location
    Wallisellen (Zürich), Switzerland
    Posts
    16,179

    Re: How to Disable a Menu Item In Win32 SDK

    Well, how are you displaying your menus?
    The usual technique is to eneble/disable menu items directly before displaying them.

  3. #3
    Join Date
    Jul 2001
    Posts
    703

    Re: How to Disable a Menu Item In Win32 SDK

    Code:
     HMENU hResMenu = LoadMenu(g_hinst, MAKEINTRESOURCE(nMenuId));//g_hinst->Handle to the module containing the menu resource to be loaded.
    
    HMENU hMenu = GetSubMenu(hResMenu,0);
    
    EnableMenuItem(hMenu, ID_COMMAND_START, MF_BYCOMMAND | MF_DISABLED);
    "Dont Forget to rate if it helped"

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,532

    Re: How to Disable a Menu Item In Win32 SDK

    Use MF_GRAYED rather than MF_DISABLED. And get some reading on those flags in MSDN.
    Best regards,
    Igor

+ Reply to Thread

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

Click Here to Expand Forum to Full Width