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. Knowing mouse state?

Knowing mouse state?

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 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.
  • 0 Offline
    0 Offline
    0v3rloader
    wrote on last edited by
    #1

    Hi there, I need to know whether the mouse cursor is within a certain area and if it has one (or more) buttons down -- but I have to do this without passing through an event handler. Is there a quick, easy way of knowing the current mouse state? Something similar to GetKeyState() but applicable for the mouse? Thanks a lot, David

    B A 2 Replies Last reply
    0
    • 0 0v3rloader

      Hi there, I need to know whether the mouse cursor is within a certain area and if it has one (or more) buttons down -- but I have to do this without passing through an event handler. Is there a quick, easy way of knowing the current mouse state? Something similar to GetKeyState() but applicable for the mouse? Thanks a lot, David

      B Offline
      B Offline
      Bhaskar
      wrote on last edited by
      #2

      Use GetCursorPos

      1 Reply Last reply
      0
      • 0 0v3rloader

        Hi there, I need to know whether the mouse cursor is within a certain area and if it has one (or more) buttons down -- but I have to do this without passing through an event handler. Is there a quick, easy way of knowing the current mouse state? Something similar to GetKeyState() but applicable for the mouse? Thanks a lot, David

        A Offline
        A Offline
        Andrew Walker
        wrote on last edited by
        #3

        GetAsyncKeyState is the function you want for mouse buttons, pass in VK_LBUTTON / VK_RBUTTON as appropriate


        If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling

        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