KeyboardHookStruct input = (KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardHookStruct));
IntPtr wcHandle = FindWindow(null, "League of Legends (TM) Client");
if (input.vkCode == (int)Keys.Z)
{
//如果钩子有效
if (wcHandle != IntPtr.Zero)
{
//设置游戏窗口到最前
SetForegroundWindow(wcHandle);
byte VK_Q = (byte)Keys.W;
keybd_event(VK_Q, 0, 0, 0);//按下
keybd_event(VK_Q, 0, KEYEVENTF_KEYUP, 0); //松开
}
return 1;
}
参考:http://www.cnblogs.com/cadlife/articles/2244775.html
这个上面没注释。。。能有清楚点的解释注释吗?