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. Mouse capture problem

Mouse capture problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
3 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.
  • M Offline
    M Offline
    Mr Freeze
    wrote on last edited by
    #1

    Hi, I'm capturing the mouse with "SetCapture()" and then process the mouse movement in OnMouseMove(UINT nFlags, CPoint point). The problem is that every time I get outside of my dialog window, the OnMouseMove routine isn't called anymore. How come:confused: My project is a dialog based application and I remember not having this problem with a non-dialog based application. Also how can I make my cursor invisible? Any idea?? Thanks:)

    C 1 Reply Last reply
    0
    • M Mr Freeze

      Hi, I'm capturing the mouse with "SetCapture()" and then process the mouse movement in OnMouseMove(UINT nFlags, CPoint point). The problem is that every time I get outside of my dialog window, the OnMouseMove routine isn't called anymore. How come:confused: My project is a dialog based application and I remember not having this problem with a non-dialog based application. Also how can I make my cursor invisible? Any idea?? Thanks:)

      C Offline
      C Offline
      Chaos Lawful
      wrote on last edited by
      #2

      I think non-dialog and dialog based applications have the same problem. Because once the mouse move outside a window, the mouse messages won't be sent to the window unless a mouse button has been pressed down. It is capable even to the window used "SetCapture()". Sorry but it's out of my reach to solve this problem. But you can use the sentence "::SetCursor(::LoadCursor(NULL,NULL));" to make your cursor invisble and use the sentence "::SetCursor(::LoadCursor(NULL,IDC_ARROW));" to restore it. And, you can always use GetCursorPos() function to retrieve the mouse cursor's current position. Hope it can help you. ;) Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

      M 1 Reply Last reply
      0
      • C Chaos Lawful

        I think non-dialog and dialog based applications have the same problem. Because once the mouse move outside a window, the mouse messages won't be sent to the window unless a mouse button has been pressed down. It is capable even to the window used "SetCapture()". Sorry but it's out of my reach to solve this problem. But you can use the sentence "::SetCursor(::LoadCursor(NULL,NULL));" to make your cursor invisble and use the sentence "::SetCursor(::LoadCursor(NULL,IDC_ARROW));" to restore it. And, you can always use GetCursorPos() function to retrieve the mouse cursor's current position. Hope it can help you. ;) Law is meaningless without chaos. Chaos without Law is equal to destruction. Chaos and Law create our rich and colorful world.

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

        Yes, your are right, I noticed that it has nothing to do with dialog/non-dialog based application. It just happened that in one I used the mouse capture while the mouse button was down... Thanks again for your help :)

        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