I am writing a program in MS VisualC++. I set a keyboard hook by hHook = SetWindowsHookEx(13,MyProc,GetModuleHandle(NULL),0);
.
There is a bug in Win7, which I can reproduce, that disables my hook. When this bug happens, hHook
is still TRUE
, but UnhookWindowsHookEx(hHook)
returns FALSE
.
However, I want to restart hook only when it gets disabled, so I can't use UnhookWindowsHookEx
.
How can I check if the hook still works? Something like GetHookStatus(hHook)
.
开发者_开发知识库I found out that this Win7 bug is caused by some timeout or "garbage collection", but it is easier for me just to check hook status and restart if needed. I am not a pro, just coding as a hobby mostly for personal needs.
Thank you.
精彩评论