小弟我安装的鼠标全局钩子为什么不管用
我安装的鼠标全局钩子为什么不管用?
钩子代码如下
安装代码如下
整个过程没有报错,但是钩子安了以后鼠标就不动了,为什么?我在钩子里不是把消息传下去了吗??为什么不管用呢?求高人解答
------解决方案--------------------
最后一个参数改成 0 试试
hMod [in]
Type: HINSTANCE
A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
钩子代码如下
LRESULT CALLBACK GetMsgProc( int code, WPARAM wParam, LPARAM lParam )
{
LRESULT returnValue = CallNextHookEx( hHook, code, wParam, lParam );
return returnValue;
}
安装代码如下
BOOL WINAPI InstallHook( BOOL IsHook, DWORD dwThreadId )
{
if(IsHook)
{
hHook=SetWindowsHookEx( WH_MOUSE_LL , (HOOKPROC)GetMsgProc, hmodDll, dwThreadId );
}
return ( hHook != NULL ) ? TRUE : FALSE;
}
整个过程没有报错,但是钩子安了以后鼠标就不动了,为什么?我在钩子里不是把消息传下去了吗??为什么不管用呢?求高人解答
VC++ 鼠标全局钩子
------解决方案--------------------
最后一个参数改成 0 试试
hMod [in]
Type: HINSTANCE
A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.