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 Postion

Mouse Postion

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
2 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.
  • S Offline
    S Offline
    sunny
    wrote on last edited by
    #1

    I have problem of getting the mouse position!!!! I want to know how to get the mouse position when user move their mouse to anywhere, but not just inside my program!!!! Anyone can help me???

    P 1 Reply Last reply
    0
    • S sunny

      I have problem of getting the mouse position!!!! I want to know how to get the mouse position when user move their mouse to anywhere, but not just inside my program!!!! Anyone can help me???

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      Hi Sunny, You may try with SetCapture(HWND) which directs mouse input to the specified window, but there are many actions the user may take that cause your application to loose the mouse capture (i.e. click on a menu). You could handle WM_CAPTURECHANGED messages, but even that wouldn't help much (refer to MSDN for details). Also, you should call ReleaseCapture() when you've finished using mouse input. If you need mouse input to do short operations, this could be fine, otherwise you may install a hook with SetWindowsHookEx() (refer to MSDN to know how to use hooks). Hope this helps, Paolo.

      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