关于钩子库问题
private static int MouseHookProc(int nCode, int wParam, IntPtr lParam)
{
if (nCode >= 0)
{
MouseLLHookStruct struct2 = (MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLLHookStruct));
MouseButtons none = MouseButtons.None;
short delta = 0;
int clicks = 0;
bool flag = false;
bool flag2 = false;
switch (wParam)
{
case 0x201:
flag = true;
none = MouseButtons.Left;
clicks = 1;
break;
case 0x202:
flag2 = true;
none = MouseButtons.Left;
clicks = 1;
break;
case 0x203:
none = MouseButtons.Left;
clicks = 2;
break;
case 0x204:
flag = true;
none = MouseButtons.Right;
clicks = 1;
break;
case 0x205:
flag2 = true;
none = MouseButtons.Right;
clicks = 1;
break;
case 0x206:
none = MouseButtons.Right;
clicks = 2;
break;
case 0x20a:
delta = (short)((struct2.MouseData >> 0x10) & 0xffff);
break;
}
MouseEventExtArgs e = new MouseEventExtArgs(none, clicks, struct2.Point.X, struct2.Point.Y, delta);
if ((s_MouseUp != null) && flag2)
{
s_MouseUp(null,e); //这里一直提示委托System.Windows.Form.MouseEventHandler一些参数无效
}
if ((s_MouseDown != null) && flag)
{
s_MouseDown(null, e); //这里一直提示委托System.Windows.Form.MouseEventHandler一些参数无效
}
if ((s_MouseClick != null) && (clicks > 0))
{
s_MouseClick(null, e); //这里一直提示委托System.Windows.Form.MouseEventHandler一些参数无效
}
if ((s_MouseClickExt != null) && (clicks > 0))
{
s_MouseClickExt(null, e);
}
if ((myMouseDoubleClick != null) && (clicks == 2))
{
myMouseDoubleClick(null, e);
}
if ((s_MouseWheel != null) && (delta != 0))
{
s_MouseWheel(null, e);
}
if (((s_MouseMove != null) || (s_MouseMoveExt != null)) && ((m_OldX != struct2.Point.X) || (m_OldY != struct2.Point.Y)))
{
m_OldX = struct2.Point.X;
m_OldY = struct2.Point.Y;
if (s_MouseMove != null)
{
s_MouseMove(null, e);
}
if (s_MouseMoveExt != null)
{
s_MouseMoveExt(null, e);
}
}
if (e.Handled)
{
return -1;
}
}
return CallNextHookEx(s_MouseHookHandle, nCode, wParam, lParam);
}
private static void OnMouseUp(object sender, MouseEventArgs e)//这里一直MouseEventArgs文件冲突
{
if (e.Clicks >= 1)
{
if (e.Button.Equals(s_PrevClickedButton))
{
if (myMouseDoubleClick != null)
{
myMouseDoubleClick(null, e); //这里一直提示委托System.Windows.Form.MouseEventHandler一些参数无效
}
s_DoubleClickTimer.Enabled = false;
s_PrevClickedButton = MouseButtons.None;
}
else
{
s_DoubleClickTimer.Enabled = true;
s_PrevClickedButton = e.Button;
}
}
}
请问大神该怎么修改??万分感谢 --------------------编程问答-------------------- 从哪里复制粘贴来的,要么这代码根本不行,要么就是你没有抄完整。 --------------------编程问答--------------------
http://www.cnblogs.com/yao2yao4/archive/2013/08/14/3256356.html
补充:.NET技术 , C#