Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

detecting input

hi..
how will i able to detect keyboard and mouse input every moment using a program running in the background..?
0
prinx
Asked:
prinx
  • 5
  • 2
1 Solution
 
jimbucciCommented:
Assuming you are running on a Windows OS:
You will need to create a system keyboard and mouse hook.

From the MSDN:
WH_KEYBOARD Hook
The WH_KEYBOARD hook enables an application to monitor message traffic for WM_KEYDOWN and WM_KEYUP messages about to be returned by the GetMessage or PeekMessage function. You can use the WH_KEYBOARD hook to monitor keyboard input posted to a message queue.

For more information, see the KeyboardProc function.

WH_MOUSE Hook
The WH_MOUSE hook enables you to monitor mouse messages about to be returned by the GetMessage or PeekMessage function. You can use the WH_MOUSE hook to monitor mouse input posted to a message queue.

For more information, see the MouseProc function.

Look at SetWindowsHookEx().

There are examples in the MSDN for how to install and use hooks.
I hope this helps.
Jim

0
 
prinxAuthor Commented:
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 
prinxAuthor Commented:
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
prinxAuthor Commented:
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 
prinxAuthor Commented:
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 
prinxAuthor Commented:
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 
jimbucciCommented:
From what I remember about hooks - your hook gets the message and determines what to do with.  It can throw it away thus preventing the app from getting the message, or pass it on to the next hook in the chain - which would probably be the system hook.  If it passes it on the app would get the message.
So, the answer is yes.
Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now