我有一个C#函数,我想弄清楚,这是代码:
private int KbHookProc(int nCode, IntPtr wParam, IntPtr lParam)
{
if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
{
var hookStruct = (KbLLHookStruct)Marshal.PtrToStructure(lParam, typeof(KbLLHookStruct));
bool ctrlDown = GetKeyState(0xA2) != 0 || GetKeyState(0xA3) != 0;
if (hookStruct.vkCode == 0x56 && hookStruct.KF_REPEAT == 0)
{
Clipboard.SetText(" ");
MessageBox.Show("Hit ?);
}
}
if (nCode >= 0 && wParam == (IntPtr)WM_KEYUP)
{
MessageBox.Show("Message : KEY UP");
}
// Pass to other keyboard handlers. Makes the Ctrl+V pass through.
return CallNextHookEx(_hookHandle, nCode, wParam, lParam);
}
所以我在这里寻找的是弄清楚当按下L_CTRL + V按钮时如何触发事件。这是工作;但是我只希望事件在按键启动后触发,为此我迷路了。任何人都可以提供任何指示吗?
答案 0 :(得分:0)