Solved

detecting input

Posted on 2002-07-12
7
188 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

743 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