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. Handling WM_INITMENUPOPUP

Handling WM_INITMENUPOPUP

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 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.
  • R Offline
    R Offline
    rrrado
    wrote on last edited by
    #1

    Hello, how can I cancel(close) the popup menu when I decide to do that in the WM_INITMENUPOPUP notification handler ? I've tried to call DestroyMenu() on provided menu handle but it does not work althought it returns 1 (success). Thank you!


    rrrado

    P 1 Reply Last reply
    0
    • R rrrado

      Hello, how can I cancel(close) the popup menu when I decide to do that in the WM_INITMENUPOPUP notification handler ? I've tried to call DestroyMenu() on provided menu handle but it does not work althought it returns 1 (success). Thank you!


      rrrado

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      How you are creating menu, can you show it? Because,I suspect, you are using temporary handle to menu(which is supposed not to use), to destroy menu.

      Prasad Notifier using ATL

      R 1 Reply Last reply
      0
      • P prasad_som

        How you are creating menu, can you show it? Because,I suspect, you are using temporary handle to menu(which is supposed not to use), to destroy menu.

        Prasad Notifier using ATL

        R Offline
        R Offline
        rrrado
        wrote on last edited by
        #3

        User is creating the menu so I think that handle is temporary. I haven't found this information that it's not for destruction - so how can I close the menu ? I've also tried PostMessage(WM_CHAR,VK_ESCAPE,1); to owning window's handle it also failed.


        rrrado

        R F P 3 Replies Last reply
        0
        • R rrrado

          User is creating the menu so I think that handle is temporary. I haven't found this information that it's not for destruction - so how can I close the menu ? I've also tried PostMessage(WM_CHAR,VK_ESCAPE,1); to owning window's handle it also failed.


          rrrado

          R Offline
          R Offline
          rrrado
          wrote on last edited by
          #4

          I've got it. It seems that sending WM_CANCELMODE does the trick :)


          rrrado

          1 Reply Last reply
          0
          • R rrrado

            User is creating the menu so I think that handle is temporary. I haven't found this information that it's not for destruction - so how can I close the menu ? I've also tried PostMessage(WM_CHAR,VK_ESCAPE,1); to owning window's handle it also failed.


            rrrado

            F Offline
            F Offline
            Frank K
            wrote on last edited by
            #5

            Hi, only a (untested) proposal. Have you tried WM_MENUSELECT? This message is (possible) send before WM_INITMENUPOPUP. -> catch the selection before the popupmenu is created HTH Frank

            1 Reply Last reply
            0
            • R rrrado

              User is creating the menu so I think that handle is temporary. I haven't found this information that it's not for destruction - so how can I close the menu ? I've also tried PostMessage(WM_CHAR,VK_ESCAPE,1); to owning window's handle it also failed.


              rrrado

              P Offline
              P Offline
              prasad_som
              wrote on last edited by
              #6

              rrrado wrote:

              User is creating the menu

              How ?

              rrrado wrote:

              I haven't found this information that it's not for destruction - so how can I close the menu ?

              It can be used for destruction, but its temporary, means you cannot store it ,and use from some other function. Can you show some code?

              Prasad Notifier using ATL

              R 1 Reply Last reply
              0
              • P prasad_som

                rrrado wrote:

                User is creating the menu

                How ?

                rrrado wrote:

                I haven't found this information that it's not for destruction - so how can I close the menu ?

                It can be used for destruction, but its temporary, means you cannot store it ,and use from some other function. Can you show some code?

                Prasad Notifier using ATL

                R Offline
                R Offline
                rrrado
                wrote on last edited by
                #7

                User press context menu key or right click. I'm not storing handle for later use. But it does not matter now as I've wrote before i've solved it by sending WM_CANCELMODE message. Thank you all guys for your time!!!


                rrrado

                P 1 Reply Last reply
                0
                • R rrrado

                  User press context menu key or right click. I'm not storing handle for later use. But it does not matter now as I've wrote before i've solved it by sending WM_CANCELMODE message. Thank you all guys for your time!!!


                  rrrado

                  P Offline
                  P Offline
                  prasad_som
                  wrote on last edited by
                  #8

                  rrrado wrote:

                  I've wrote before i've solved it by sending WM_CANCELMODE message

                  I've seen your post , after posting mine. And today, there seems to be problem with modifying post. So, it is there as it is. :)

                  Prasad Notifier using ATL

                  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