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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Introducing mouse delay (local machine)

Introducing mouse delay (local machine)

Scheduled Pinned Locked Moved C / C++ / MFC
questiondesigntutorial
3 Posts 3 Posters 1 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.
  • K Offline
    K Offline
    Kannan Ramanathan
    wrote on last edited by
    #1

    I am trying to make Windows render the mouse cursor with a user-defined delay (in milliseconds). For ex., if the user-defined delay is 100ms, the mouse should be rendered 100ms after the user moved the mouse (If you are wondering what is the use-case for this, I am doing this as a part of UI/Usability study that we are doing internally). As a system sw guy, my initial inclination was "lets put something next to mouclass drv", but wanted to check out the user mode first (since the code most prob will be picked up by another app-only developer). I tried the low-level hooks from an article here in CP...it worked fine for tracking the mouse, but I didn't know how to introduce the delay... Any ideas? TIA.

    _ C 2 Replies Last reply
    0
    • K Kannan Ramanathan

      I am trying to make Windows render the mouse cursor with a user-defined delay (in milliseconds). For ex., if the user-defined delay is 100ms, the mouse should be rendered 100ms after the user moved the mouse (If you are wondering what is the use-case for this, I am doing this as a part of UI/Usability study that we are doing internally). As a system sw guy, my initial inclination was "lets put something next to mouclass drv", but wanted to check out the user mode first (since the code most prob will be picked up by another app-only developer). I tried the low-level hooks from an article here in CP...it worked fine for tracking the mouse, but I didn't know how to introduce the delay... Any ideas? TIA.

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      The system sends the WM_SETCURSOR message to a window if the mouse is moved. You could probably hook this message using SetWindowsHookEx(WH_CALLWNDPROC, ... and introduce the delay there.

      «_Superman_» I love work. It gives me something to do between weekends.

      1 Reply Last reply
      0
      • K Kannan Ramanathan

        I am trying to make Windows render the mouse cursor with a user-defined delay (in milliseconds). For ex., if the user-defined delay is 100ms, the mouse should be rendered 100ms after the user moved the mouse (If you are wondering what is the use-case for this, I am doing this as a part of UI/Usability study that we are doing internally). As a system sw guy, my initial inclination was "lets put something next to mouclass drv", but wanted to check out the user mode first (since the code most prob will be picked up by another app-only developer). I tried the low-level hooks from an article here in CP...it worked fine for tracking the mouse, but I didn't know how to introduce the delay... Any ideas? TIA.

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        How about this approach: -you run a thread which contains a queue of delayed mouse messages, the queue could contain a timestamp for each message and the thread would check the first message's timestamp and if if the time has come, it would inject it back to the system and remove it from its own queue. -In your mouse hook you would need a way to be able to determine if the incoming message is a delayed one or not, if it is, pass it on, if it is not a delayed message then do not pass it on but put it in the other thread's queue with the right timestamp (for example: now + delay). It's just an idea, i haven't tried this nor have an idea how it would perform.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

        modified on Tuesday, June 9, 2009 6:22 AM

        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