我这样钩,没钩到,是哪里有问题呢?
private static int CurHookProc(int nCode, Int32 wParam, IntPtr lParam)
{
CwpStruct lp = (CwpStruct)Marshal.PtrToStructure(lParam, typeof(CwpStruct));
Debugger.Log(0, null, String.Format("{0:D},{1:D},{2:D}", nCode, (int)lp.wparam,(int)lp.lparam));
if (lp.wparam == (IntPtr)WM_MOUSE.WM_SETCURSOR)
{
Debugger.Log(0, null, "SETCURSOR");
return 0;
}
return Win32API.CallNextHookEx(mCurHook, nCode, wParam, lParam);
}
if (mCurHook == IntPtr.Zero)
{
mCurHookProcedure = CurHookProc;
//注册线程钩子时第三个参数是空
mCurHook = Win32API.SetWindowsHookEx(WH_CODE.WH_CALLWNDPROCRET, mCurHookProcedure, IntPtr.Zero, result);
if (mCurHook == IntPtr.Zero)
{
return false;
}
}