Click here to Skip to main content
15,906,455 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,
I want to use C++ language to hook Keyboard into only an extern application (identified - e.g: Notepad), how to I do this? Thanks. Can you help me this demo?
Posted
Updated 23-Feb-11 0:40am
v2

1 solution

Well one method would be to use a Windows Hook in a DLL, and get it to check the Window that has the focus, and see if it belongs to the app you which to monitor. i.e. Does the windows belong to a instance of notepad.exe.

It is very easy to do that, I have done it myself personally for a project I have made.

Or you could just Google for it.
 
Share this answer
 
Comments
Sandeep Mewara 23-Feb-11 8:47am    
Good answer.
CodyDaemon 23-Feb-11 9:47am    
Well the only other method that springs to mind involves injecting code into notepad and hi-hacking the WndProc calls to filter out WM_KEYxxxx and WM_CHAR messages and handling them then before passing control back to the real WndProc. What is not really the easiest method.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900