Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Enable/disable popup menu items

Enable/disable popup menu items

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr Freeze
    wrote on last edited by
    #1

    Hi :) I have a popup-menu associated with a window, and I want to specify for each menu entry if it is enabled/disabled. So I'm wondering if my window sends some messages (similar to WM_LBUTTONDOWN for example) just before displaying a menu item? I would like to be able to intercept that message and actualize the enabled/disabled state of that item. I read something about ON_UPDATE_COMMAND_UI but my window is created with CreateWindowEx and I can't do anything with classwizard. How can I handle this task easily :confused: Thanks :)

    R R 2 Replies Last reply
    0
    • M Mr Freeze

      Hi :) I have a popup-menu associated with a window, and I want to specify for each menu entry if it is enabled/disabled. So I'm wondering if my window sends some messages (similar to WM_LBUTTONDOWN for example) just before displaying a menu item? I would like to be able to intercept that message and actualize the enabled/disabled state of that item. I read something about ON_UPDATE_COMMAND_UI but my window is created with CreateWindowEx and I can't do anything with classwizard. How can I handle this task easily :confused: Thanks :)

      R Offline
      R Offline
      Rickard Andersson20
      wrote on last edited by
      #2

      Handle WM_INITMENU. See MSDN to read about WM_INITMENU ------------------------------ ©0d3 ©®4©k3® - That's me! :) ------------------------------

      1 Reply Last reply
      0
      • M Mr Freeze

        Hi :) I have a popup-menu associated with a window, and I want to specify for each menu entry if it is enabled/disabled. So I'm wondering if my window sends some messages (similar to WM_LBUTTONDOWN for example) just before displaying a menu item? I would like to be able to intercept that message and actualize the enabled/disabled state of that item. I read something about ON_UPDATE_COMMAND_UI but my window is created with CreateWindowEx and I can't do anything with classwizard. How can I handle this task easily :confused: Thanks :)

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        I dynamically construct the popup menu when I detect a right mouse button click. This way, you can set the disabled state of individual menu items. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com

        M 1 Reply Last reply
        0
        • R Ravi Bhavnani

          I dynamically construct the popup menu when I detect a right mouse button click. This way, you can set the disabled state of individual menu items. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com

          M Offline
          M Offline
          Mr Freeze
          wrote on last edited by
          #4

          That works fine, thanks :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups