开发者

How to check if SetWindowsHookEx hook is still working? (Win7 bug workaround)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜