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. Tracking the mouse

Tracking the mouse

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 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.
  • B Offline
    B Offline
    Bret Faller
    wrote on last edited by
    #1

    I have a dialog based app that docks to the edge of the screen and auto-hides itself like the taskbar and I need to be able to tell when the mouse cursor hits the edge of the screen so I can restore my dialog. I've looked on MSDN but couldn't really find anything great, I know I can hack it and leave a corner of the dialog out and then show when the mouse enters (WM_MOUSEMOVE) but that isn't really what I want. Any help is greatly appreciated. Bret Faller Odyssey Computing, Inc.

    C 1 Reply Last reply
    0
    • B Bret Faller

      I have a dialog based app that docks to the edge of the screen and auto-hides itself like the taskbar and I need to be able to tell when the mouse cursor hits the edge of the screen so I can restore my dialog. I've looked on MSDN but couldn't really find anything great, I know I can hack it and leave a corner of the dialog out and then show when the mouse enters (WM_MOUSEMOVE) but that isn't really what I want. Any help is greatly appreciated. Bret Faller Odyssey Computing, Inc.

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

      I believe you're looking for GetMouseMovePointsEx and GetLastInputInfo These are the key API calls that you will need; and of course, you'll need knowledge of the screen size using GetSystemMetrics. CodeGuy http://groups.yahoo.com/group/wtl

      B 1 Reply Last reply
      0
      • C CodeGuy

        I believe you're looking for GetMouseMovePointsEx and GetLastInputInfo These are the key API calls that you will need; and of course, you'll need knowledge of the screen size using GetSystemMetrics. CodeGuy http://groups.yahoo.com/group/wtl

        B Offline
        B Offline
        Bret Faller
        wrote on last edited by
        #3

        Yeah, I've seen those functions but I need to continually monitor the mouse while my program is running, would that require another thread that only watches the mouse movements and what function would be a good place for these functions? Thanks for your response. Bret Faller Odyssey Computing, Inc.

        C 1 Reply Last reply
        0
        • B Bret Faller

          Yeah, I've seen those functions but I need to continually monitor the mouse while my program is running, would that require another thread that only watches the mouse movements and what function would be a good place for these functions? Thanks for your response. Bret Faller Odyssey Computing, Inc.

          C Offline
          C Offline
          CodeGuy
          wrote on last edited by
          #4

          I don't think I would bother with a thread. I'd investigate just using a timer function (i.e. handling WM_TIMER), since nothing is time critical about checking for mouse movements. Best regards, CodeGuy The WTL newsgroup: 860 members and growing ... http://groups.yahoo.com/group/wtl

          B 2 Replies Last reply
          0
          • C CodeGuy

            I don't think I would bother with a thread. I'd investigate just using a timer function (i.e. handling WM_TIMER), since nothing is time critical about checking for mouse movements. Best regards, CodeGuy The WTL newsgroup: 860 members and growing ... http://groups.yahoo.com/group/wtl

            B Offline
            B Offline
            Bret Faller
            wrote on last edited by
            #5

            Thanks, sounds good to me. Bret Faller Odyssey Computing, Inc.

            1 Reply Last reply
            0
            • C CodeGuy

              I don't think I would bother with a thread. I'd investigate just using a timer function (i.e. handling WM_TIMER), since nothing is time critical about checking for mouse movements. Best regards, CodeGuy The WTL newsgroup: 860 members and growing ... http://groups.yahoo.com/group/wtl

              B Offline
              B Offline
              Bret Faller
              wrote on last edited by
              #6

              One problem, for some reason there is no such thing as MOUSEMOVEPOINT structure in my header files. Any ideas? I did a find in files search and got nothing. Bret Faller Odyssey Computing, Inc.

              C 1 Reply Last reply
              0
              • B Bret Faller

                One problem, for some reason there is no such thing as MOUSEMOVEPOINT structure in my header files. Any ideas? I did a find in files search and got nothing. Bret Faller Odyssey Computing, Inc.

                C Offline
                C Offline
                CodeGuy
                wrote on last edited by
                #7

                Bret, I steered you wrong. :( The reason MOUSEMOVEPOINT is not available is because GetMouseMovePointsEx is a Win2000/Me API call. You would have to get the latest Platform SDK, but I suspect you would not want a solution for just those 2 operating systems. :) OK, well, this is more complicated, but you will have to do a Windows system hook to capture the mouse messages sent to the desktop. Take a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmgmt/html/msdn\_hooks32.asp CodeGuy The WTL newsgroup: 860 members and growing ... http://groups.yahoo.com/group/wtl

                B 1 Reply Last reply
                0
                • C CodeGuy

                  Bret, I steered you wrong. :( The reason MOUSEMOVEPOINT is not available is because GetMouseMovePointsEx is a Win2000/Me API call. You would have to get the latest Platform SDK, but I suspect you would not want a solution for just those 2 operating systems. :) OK, well, this is more complicated, but you will have to do a Windows system hook to capture the mouse messages sent to the desktop. Take a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmgmt/html/msdn\_hooks32.asp CodeGuy The WTL newsgroup: 860 members and growing ... http://groups.yahoo.com/group/wtl

                  B Offline
                  B Offline
                  Bret Faller
                  wrote on last edited by
                  #8

                  Thanks for your help. Bret Faller Odyssey Computing, Inc.

                  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