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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. dear brother, can you tell me how to hook the messages of a short-cut menu?

dear brother, can you tell me how to hook the messages of a short-cut menu?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
9 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.
  • N Offline
    N Offline
    nenfa
    wrote on last edited by
    #1

    dear brother, can you tell me how to hook the messages of a short-cut menu? for example, the short-cut menu on the desktop

    _ L 2 Replies Last reply
    0
    • N nenfa

      dear brother, can you tell me how to hook the messages of a short-cut menu? for example, the short-cut menu on the desktop

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      Menu commands are sent using WM_COMMAND. You should be able to intercept them using SetWindowsHookEx with WH_CALLWNDPROC.

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      N 1 Reply Last reply
      0
      • _ _Superman_

        Menu commands are sent using WM_COMMAND. You should be able to intercept them using SetWindowsHookEx with WH_CALLWNDPROC.

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        N Offline
        N Offline
        nenfa
        wrote on last edited by
        #3

        i can see one message WM_ENTERMENULOOP that sends to menu, but i don't see any messages of mouse sent to menu, how can i hook these message

        1 Reply Last reply
        0
        • N nenfa

          dear brother, can you tell me how to hook the messages of a short-cut menu? for example, the short-cut menu on the desktop

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          sunen wrote:

          for example, the short-cut menu on the desktop

          What exactly do you mean by this, the start menu or the context menu (right-click)?

          N 1 Reply Last reply
          0
          • L Lost User

            sunen wrote:

            for example, the short-cut menu on the desktop

            What exactly do you mean by this, the start menu or the context menu (right-click)?

            N Offline
            N Offline
            nenfa
            wrote on last edited by
            #5

            aha, what i want is the context menu, thank you

            L 1 Reply Last reply
            0
            • N nenfa

              aha, what i want is the context menu, thank you

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              sunen wrote:

              what i want is the context menu

              In that case I think you may have to hook the WM_CONTEXTMENU message. See the MSDN docuentation for more details.

              N 2 Replies Last reply
              0
              • L Lost User

                sunen wrote:

                what i want is the context menu

                In that case I think you may have to hook the WM_CONTEXTMENU message. See the MSDN docuentation for more details.

                N Offline
                N Offline
                nenfa
                wrote on last edited by
                #7

                i have seen the msdn, but i still have no idea to implement it , can you give me some tips, thank you very much

                1 Reply Last reply
                0
                • L Lost User

                  sunen wrote:

                  what i want is the context menu

                  In that case I think you may have to hook the WM_CONTEXTMENU message. See the MSDN docuentation for more details.

                  N Offline
                  N Offline
                  nenfa
                  wrote on last edited by
                  #8

                  maybe i need clear what i exactly want? the scene: i have right-clicked on the desktop, so i receive the WM_CONTEXTMENU message and get one short-cut menu, now i am operating mouse and produce some message, for example, WM_MOUSEMOVE, WM_LBUTTONDOWN, and so on, the key point is how can i hook these message?

                  L 1 Reply Last reply
                  0
                  • N nenfa

                    maybe i need clear what i exactly want? the scene: i have right-clicked on the desktop, so i receive the WM_CONTEXTMENU message and get one short-cut menu, now i am operating mouse and produce some message, for example, WM_MOUSEMOVE, WM_LBUTTONDOWN, and so on, the key point is how can i hook these message?

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    You need to use the SetWindowsHookEx()[^] function to monitor the messages going through the system, then activate whatever you need when you see the message that you are interested in. The following CodeProject Article[^] explains how you can utilise this feature.

                    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