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. How to determine the control under cursor

How to determine the control under cursor

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
6 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.
  • A Offline
    A Offline
    Arrin
    wrote on last edited by
    #1

    Hello community, i need to determine the control under the cursor, to call "vertical scroll" event for it! I have two CListCtrl-controls in my dialog, so if the mouse is over one of them, it should be possible to scroll in this control without clicking inside of control! Just like in MS Outlook, if mouse is over "preview" area, you can use mouse wheel without clicking in this control to scroll! Thanks for any help! Arrin

    C 1 Reply Last reply
    0
    • A Arrin

      Hello community, i need to determine the control under the cursor, to call "vertical scroll" event for it! I have two CListCtrl-controls in my dialog, so if the mouse is over one of them, it should be possible to scroll in this control without clicking inside of control! Just like in MS Outlook, if mouse is over "preview" area, you can use mouse wheel without clicking in this control to scroll! Thanks for any help! Arrin

      C Offline
      C Offline
      CodyDaemon
      wrote on last edited by
      #2

      Well the cheap and cheerful way would be to call WindowFromPoint[^] when you have a WM_MOUSEWHEEL message. That will return the handle of the window/control under the mouse, then you can just SendMessage it the scroll.

      A 2 Replies Last reply
      0
      • C CodyDaemon

        Well the cheap and cheerful way would be to call WindowFromPoint[^] when you have a WM_MOUSEWHEEL message. That will return the handle of the window/control under the mouse, then you can just SendMessage it the scroll.

        A Offline
        A Offline
        Arrin
        wrote on last edited by
        #3

        Hello, thanks for answer,i try to do this, but there is an little problem :) when i use WM_MOUSEWHEEL windows catch this event only i my mouse is not over a CListCtrl! :( But i need to use when is OVER an CListCtrl, to set set focus to this list control! regards Arrin

        D 1 Reply Last reply
        0
        • A Arrin

          Hello, thanks for answer,i try to do this, but there is an little problem :) when i use WM_MOUSEWHEEL windows catch this event only i my mouse is not over a CListCtrl! :( But i need to use when is OVER an CListCtrl, to set set focus to this list control! regards Arrin

          D Offline
          D Offline
          Damir Valiulin
          wrote on last edited by
          #4

          Try adding the wm_mousewheel handler in the dialog class. This message is always sent to parent first and then passed down to children

          A 1 Reply Last reply
          0
          • D Damir Valiulin

            Try adding the wm_mousewheel handler in the dialog class. This message is always sent to parent first and then passed down to children

            A Offline
            A Offline
            Arrin
            wrote on last edited by
            #5

            Hello, thanks for suggestions, it works with WM_MOUSEWHEEL message! Best regards Arrin

            1 Reply Last reply
            0
            • C CodyDaemon

              Well the cheap and cheerful way would be to call WindowFromPoint[^] when you have a WM_MOUSEWHEEL message. That will return the handle of the window/control under the mouse, then you can just SendMessage it the scroll.

              A Offline
              A Offline
              Arrin
              wrote on last edited by
              #6

              Hi, thanks, it works with wm_mousewheel regards arrin

              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