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. 'Beep' when calling "TrackPopupMenu"??

'Beep' when calling "TrackPopupMenu"??

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestiondiscussion
4 Posts 2 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.
  • J Offline
    J Offline
    JennyP
    wrote on last edited by
    #1

    Hello, I respond to a LVN_KEYDOWN event (List View in column mode) and if the user presses enter, I call another function with the following code. When this occurs, there is the audible beep. I don't want the beep. When I call this same code from the OnRButtonDown() (user presses right mouse button) there is no audible beep. I didn't find any documentation in CMenu that would help me determine why there is a beep. My assumption is that the "enter" key is still in some buffer, and the TrackPopupMenu thought it was an invalid selection?? Any thoughts on how to get rid of the beep? menu.CreatePopupMenu(); int levels = GetDocument()->m_nPriorityLevels-1; for (i=levels;i>=0; i--) { menu.AppendMenu(0, IDC_PRI_0+i, GetDocument()->m_sPriority[i]); } menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); thanks! JennyP

    N 1 Reply Last reply
    0
    • J JennyP

      Hello, I respond to a LVN_KEYDOWN event (List View in column mode) and if the user presses enter, I call another function with the following code. When this occurs, there is the audible beep. I don't want the beep. When I call this same code from the OnRButtonDown() (user presses right mouse button) there is no audible beep. I didn't find any documentation in CMenu that would help me determine why there is a beep. My assumption is that the "enter" key is still in some buffer, and the TrackPopupMenu thought it was an invalid selection?? Any thoughts on how to get rid of the beep? menu.CreatePopupMenu(); int levels = GetDocument()->m_nPriorityLevels-1; for (i=levels;i>=0; i--) { menu.AppendMenu(0, IDC_PRI_0+i, GetDocument()->m_sPriority[i]); } menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); thanks! JennyP

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #2

      In the function that handles LVN_KEYDOWN have you tried changing the return value when Enter is handled by your code. Notification functions use *lParam for this if my memory serves me correctly. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program

      J 1 Reply Last reply
      0
      • N Neville Franks

        In the function that handles LVN_KEYDOWN have you tried changing the return value when Enter is handled by your code. Notification functions use *lParam for this if my memory serves me correctly. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program

        J Offline
        J Offline
        JennyP
        wrote on last edited by
        #3

        Thank you for the suggestion. This doesn't seem to solve the issue. The beep occurs (according to debugger) when I call: menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); JennyP

        N 1 Reply Last reply
        0
        • J JennyP

          Thank you for the suggestion. This doesn't seem to solve the issue. The beep occurs (according to debugger) when I call: menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); JennyP

          N Offline
          N Offline
          Neville Franks
          wrote on last edited by
          #4

          It is probably the KeyUp message which is causing the beep. ie. It is going to the Menu. Have you tried using NM_RETURN instead. Failing that you could add a PeekMessage loop and wait for the KeyUp message before calling TrackPopupMenu. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program

          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