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#
  4. Stealing the Mouse

Stealing the Mouse

Scheduled Pinned Locked Moved C#
question
5 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.
  • I Offline
    I Offline
    IceWater42
    wrote on last edited by
    #1

    I have a need to grab the mouse and move it to specific locations in a target window, approximately once a second. Each time I grab the mouse, I save it's current position and put it back when i am done. However, I do not want to grab the mouse if the User is currently using it (like when pressing the left button for a drag) in some OTHER application as that causes undesirable effects and is a MAJOR irritation to the User. I think I need to get information about the mouse buttons that is system-wide in scope (not form-specific nor thread-specific). I hope that makes sense. Any ideas? Thanks.

    L 1 Reply Last reply
    0
    • I IceWater42

      I have a need to grab the mouse and move it to specific locations in a target window, approximately once a second. Each time I grab the mouse, I save it's current position and put it back when i am done. However, I do not want to grab the mouse if the User is currently using it (like when pressing the left button for a drag) in some OTHER application as that causes undesirable effects and is a MAJOR irritation to the User. I think I need to get information about the mouse buttons that is system-wide in scope (not form-specific nor thread-specific). I hope that makes sense. Any ideas? Thanks.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      You might use the MouseEnter and MouseLeave events to keep track of the presence/absence of the mouse in your application. Remark: some special care may be required when you also use menus, since clicking them seems to interact with the normal Enter/Leave sequences. :)

      Luc Pattyn

      I 1 Reply Last reply
      0
      • L Luc Pattyn

        You might use the MouseEnter and MouseLeave events to keep track of the presence/absence of the mouse in your application. Remark: some special care may be required when you also use menus, since clicking them seems to interact with the normal Enter/Leave sequences. :)

        Luc Pattyn

        I Offline
        I Offline
        IceWater42
        wrote on last edited by
        #3

        thanks for response ... but that does not help ... i need to know when the mouse is IN USE, not when it has left MY form.

        L 1 Reply Last reply
        0
        • I IceWater42

          thanks for response ... but that does not help ... i need to know when the mouse is IN USE, not when it has left MY form.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          OK :cool: , sounds much like activity detection; this is used e.g. by screen savers, so I suggest you look at one of the many screen savers on CodeProject. Furthermore, you could look at a "global system hook" (as explained in http://www.codeproject.com/csharp/globalsystemhook.asp[^]).

          Luc Pattyn

          I 1 Reply Last reply
          0
          • L Luc Pattyn

            OK :cool: , sounds much like activity detection; this is used e.g. by screen savers, so I suggest you look at one of the many screen savers on CodeProject. Furthermore, you could look at a "global system hook" (as explained in http://www.codeproject.com/csharp/globalsystemhook.asp[^]).

            Luc Pattyn

            I Offline
            I Offline
            IceWater42
            wrote on last edited by
            #5

            thank you, luc ... will do

            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