Solved

detecting input

Posted on 2002-07-12
7
189 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now