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. How do I detect any mouse/key input at application level

How do I detect any mouse/key input at application level

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 4 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.
  • G Offline
    G Offline
    g_sandipan
    wrote on last edited by
    #1

    How do I detect any mouse/key input at application level. I have an MDI application where processing of mouse/key events are handled in view/doc class of the child window. I need to check if any mouse/key input didn't occured for a specific time period. I want to handle them in application or MDI so that I can only in one place. But I am getting only WM_MOUSEACTIVATE, WM_SETCURSOR messages in MDI level. Please help with any suggestion/idea. Thanks in advance

    Sandip

    _ N 2 Replies Last reply
    0
    • G g_sandipan

      How do I detect any mouse/key input at application level. I have an MDI application where processing of mouse/key events are handled in view/doc class of the child window. I need to check if any mouse/key input didn't occured for a specific time period. I want to handle them in application or MDI so that I can only in one place. But I am getting only WM_MOUSEACTIVATE, WM_SETCURSOR messages in MDI level. Please help with any suggestion/idea. Thanks in advance

      Sandip

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

      Install a mouse hook locally in your application using SetWindowsHookEx. Start a timer that increments a variable. Whenever a mouse message occurs the hook procedure will be called. In the hook procedure reset the variable to 0. Do the same for keyboard with a keyboard hook.

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

      G 1 Reply Last reply
      0
      • G g_sandipan

        How do I detect any mouse/key input at application level. I have an MDI application where processing of mouse/key events are handled in view/doc class of the child window. I need to check if any mouse/key input didn't occured for a specific time period. I want to handle them in application or MDI so that I can only in one place. But I am getting only WM_MOUSEACTIVATE, WM_SETCURSOR messages in MDI level. Please help with any suggestion/idea. Thanks in advance

        Sandip

        N Offline
        N Offline
        Nibu babu thomas
        wrote on last edited by
        #3

        g_sandipan wrote:

        I need to check if any mouse/key input didn't occured for a specific time period.

        GetLastInputInfo[^] is useful to detect input idle time.

        Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

        S 1 Reply Last reply
        0
        • N Nibu babu thomas

          g_sandipan wrote:

          I need to check if any mouse/key input didn't occured for a specific time period.

          GetLastInputInfo[^] is useful to detect input idle time.

          Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

          S Offline
          S Offline
          Sunil Lanke
          wrote on last edited by
          #4

          For that u need to user TIMER, on Application startup u need to start it, and if any MOUSE/key input occurred, then u need to again restart the timer. :) Regards, Sunil

          1 Reply Last reply
          0
          • _ _Superman_

            Install a mouse hook locally in your application using SetWindowsHookEx. Start a timer that increments a variable. Whenever a mouse message occurs the hook procedure will be called. In the hook procedure reset the variable to 0. Do the same for keyboard with a keyboard hook.

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

            G Offline
            G Offline
            g_sandipan
            wrote on last edited by
            #5

            Thanks for the advice...

            Sandip

            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