我现在试图使用hook函数,根据网上找的,试着在自己的程序里面不创建dll而使用一个键盘钩子函数。但是,链接的时候穿西安了问题。
"class CCalculator_TestApp theApp" (?theApp@@3VCCalculator_TestApp@@A) already defined in Calculator_Test.obj
看意思是theApp已经在这个obj文件内被创建,但是我取消后。连编译都过不去了。 有什么办法解决没有?
钩子函数调用的时候是这样
hook = SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,theApp.m_hInstance,0);
莫非只能写dll在使用钩子函数,没别的方法了?大虾们赐教一下啊。
"class CCalculator_TestApp theApp" (?theApp@@3VCCalculator_TestApp@@A) already defined in Calculator_Test.obj
看意思是theApp已经在这个obj文件内被创建,但是我取消后。连编译都过不去了。 有什么办法解决没有?
钩子函数调用的时候是这样
hook = SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,theApp.m_hInstance,0);
莫非只能写dll在使用钩子函数,没别的方法了?大虾们赐教一下啊。
HHOOK SetWindowsHookEx( int idHook,
HOOKPROC lpfn,
HINSTANCE hMod,
DWORD dwThreadId
);
hMod
[in] 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.dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.
hook = SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc,NULL,0);
//这样试试
比如:
123 123 但是比较结果是不相等
123 123123 结果却相等,这是为什么?郁闷啊!