咨询一个底层键盘钩子的问题 急!!!!!
用 底层键盘钩子 钩按键消息 写在 了 Textbox 中 但是每次按一个键 都把该键值重复2次 大印出来
键盘处理函数是这样的
private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)
{
KeyMSG keymsg = (KeyMSG)Marshal.PtrToStructure(lParam, typeof(KeyMSG));
switch ((Keys)keymsg.vkCode)
{
case Keys.A: textBox1.Text += "A"; break;
case Keys.B: textBox1.Text += "B"; break;
case Keys.C: textBox1.Text += "C"; break;
case Keys.D: textBox1.Text += "D"; break;
case Keys.E: textBox1.Text += "E"; break;
case Keys.F: textBox1.Text += "F"; break;
case Keys.G: textBox1.Text += "G"; break;
case Keys.H: textBox1.Text += "H"; break;
case Keys.I: textBox1.Text += "I"; break;
case Keys.J: textBox1.Text += "J"; break;
case Keys.K: textBox1.Text += "K"; break;
case Keys.L: textBox1.Text += "L"; break;
case Keys.M: textBox1.Text += "M"; break;
case Keys.N: textBox1.Text += "N"; break;
case Keys.O: textBox1.Text += "O"; break;
default: textBox1.Text += "---OVER"; break;
}
return 0;
}
请问是什么原因
在线等答案!!!!