|
-
November 17th, 2008, 07:51 AM
#1
change the Keybord Input
How to change the input from keyboard before it has been processed by the target window?
Thanx for any kind of help...
Regards,
Shail2k4
-
November 17th, 2008, 07:56 AM
#2
Re: change the Keybord Input
Using WH_KEYBOARD hook, I guess.
Victor Nijegorodov
-
November 17th, 2008, 08:09 AM
#3
Re: change the Keybord Input
 Originally Posted by VictorN
Using WH_KEYBOARD hook, I guess.
Thanx for the reply...
Only one thing in my mind is that the input must be changed before the application processes it.
Consider an application A which contains a text field sey "Name". Now if user types "A" in the "Name" field then it should be changed to "B".
Regards,
Shail2k4
-
November 17th, 2008, 08:42 AM
#4
Re: change the Keybord Input
Why do you want to do that?
You won't find help writing malicious code here.
-
November 17th, 2008, 09:08 AM
#5
Re: change the Keybord Input
 Originally Posted by shail2k4
Consider an application A which contains a text field sey "Name". Now if user types "A" in the "Name" field then it should be changed to "B".
The complete code in C had been posted many times on api ng
news://nntp.aioe.org/comp.os.ms-wind...ogrammer.win32
since '90s
- and it's not with WH_KEYBOARD)
-
November 17th, 2008, 09:14 AM
#6
Re: change the Keybord Input
 Originally Posted by GCDEF
Why do you want to do that?
You won't find help writing malicious code here.
I want to break up a barcode input into two string by replacing some special characters. The best way i know is by using hooks.
Thanx for any kind of help,
Regards,
Shail2k4
-
November 17th, 2008, 09:15 AM
#7
Re: change the Keybord Input
 Originally Posted by shail2k4
I want to break up a barcode input into two string by replacing some special characters. The best way i know is by using hooks.
Thanx for any kind of help,
Regards,
Shail2k4
What does that have to do with your original question?
-
November 17th, 2008, 09:18 AM
#8
Re: change the Keybord Input
 Originally Posted by GCDEF
What does that have to do with your original question?
Barcode scanner is connected to the keyboard via PS2 port, the scanned code is same as the keyboard input and i can monitor it with the WH_KEYBOARD hook but can not change.
-
November 17th, 2008, 09:31 AM
#9
Re: change the Keybord Input
 Originally Posted by shail2k4
Barcode scanner is connected to the keyboard via PS2 port, the scanned code is same as the keyboard input and i can monitor it with the WH_KEYBOARD hook but can not change.
Perhaps you could do something with PreTranslateMessage or handling WM_CHAR.
-
November 17th, 2008, 09:38 AM
#10
Re: change the Keybord Input
 Originally Posted by shail2k4
... i can monitor it with the WH_KEYBOARD hook but can not change.
Could you show how you have tried to change it?
Victor Nijegorodov
-
November 17th, 2008, 09:53 AM
#11
Re: change the Keybord Input
 Originally Posted by GCDEF
Perhaps you could do something with PreTranslateMessage or handling WM_CHAR.
The barcode input may be in any application, means that the barcode data should be changed on the scanning globally.
The global hook can monitor the code. now how can i use PreTranslateMessage message globally.
-
November 18th, 2008, 12:43 AM
#12
Re: change the Keybord Input
 Originally Posted by VictorN
Could you show how you have tried to change it?
Code:
LRESULT CALLBACK KeyboardProc(INT nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode != HC_ACTION)
return ::CallNextHookEx(g_hHook, nCode, wParam, lParam);
if(wParam==' ' || wParam==',')
wParam=0x0d;
return ::CallNextHookEx(g_hHook, nCode, wParam, lParam);
}
Please suggest me if it is wrong.
-
November 18th, 2008, 02:10 AM
#13
Re: change the Keybord Input
Is there any way that i can block the input of "," or "#" or SPACE and replace it with ENTER using the WH_KEYBOARD hook ?
-
November 18th, 2008, 04:01 AM
#14
Re: change the Keybord Input
 Originally Posted by shail2k4
Please suggest me if it is wrong.
I never used global hooks, therefore can only guess: perhaps, you should also change the scan code part of LPARAM?
Another variant - try to SendInput with VK_RETURN instead.
Victor Nijegorodov
-
November 18th, 2008, 05:20 AM
#15
Re: change the Keybord Input
 Originally Posted by VictorN
I never used global hooks, therefore can only guess: perhaps, you should also change the scan code part of LPARAM?
Another variant - try to SendInput with VK_RETURN instead. 
Everything is resolved for the Window Based Application, the need was to use WH_GETMESSAGE.
Now only one thing is that its not working for DOS based application.
Regards,
Shail2k4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|