Re: change the Keybord Input
Using WH_KEYBOARD hook, I guess.
Re: change the Keybord Input
Quote:
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
Re: change the Keybord Input
Why do you want to do that?
You won't find help writing malicious code here.
Re: change the Keybord Input
Quote:
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)
Re: change the Keybord Input
Quote:
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
Re: change the Keybord Input
Quote:
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?
Re: change the Keybord Input
Quote:
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.
Re: change the Keybord Input
Quote:
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.
Re: change the Keybord Input
Quote:
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?
Re: change the Keybord Input
Quote:
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.
Re: change the Keybord Input
Quote:
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.
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 ?
Re: change the Keybord Input
Quote:
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. :confused:
Re: change the Keybord Input
Quote:
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. :confused:
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