Solved

detecting input

Posted on 2002-07-12
7
194 Views
Last Modified: 2010-04-01
hi..
how will i able to detect keyboard and mouse input every moment using a program running in the background..?
0
Comment
Question by:prinx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
jimbucci earned 50 total points
ID: 7148635
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
 

Author Comment

by:prinx
ID: 7148946
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 

Author Comment

by:prinx
ID: 7148948
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:prinx
ID: 7148950
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 

Author Comment

by:prinx
ID: 7148951
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 

Author Comment

by:prinx
ID: 7148952
den it is possible to intercept the messages for eg..stopping particular keydown event from being handled by its app ?
0
 
LVL 3

Expert Comment

by:jimbucci
ID: 7148998
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question