After using HOOK to catch the KeyPress message,is it possible to modify the content of the message?

½

½£¾ªºè

Give an example:When user pressed "B" or "b",HOOK get that message and let
TextBox1.text display "a".

The executing founction is as following:
****************************************
IntPtr MyHookProc(int code, IntPtr wparam, IntPtr lparam)
{
if( code < 0 ) return CallNextHookEx(_nextHookPtr,code, wparam, lparam);
if( wparam.ToInt32() == 98 || wparam.ToInt32() == 66 )
{
this.textBox1.Text = "a";
return (IntPtr) 1;
}
else
{
return IntPtr.Zero;
}
}
****************************************

But if I want to use hook to catch and change the KeyPress Message what was
just made by user,that solution does not work.

My Problem is that using hook to catch the message "B" or "b",and then
change it as "a".Please modify the above function directly,thank you.

That problem confused me quite along time,I am nearly crazy!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top