首页 新闻 会员 周边 捐助

怎么钩setcursor消息

0
[已关闭问题] 关闭于 2016-07-05 09:13

我这样钩,没钩到,是哪里有问题呢?

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;
                }
            }

Jingle Guo的主页 Jingle Guo | 初学一级 | 园豆:134
提问于:2016-07-04 09:35
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册