I have installed a global mouse hook. Then when I finish doing something, I call UnhookWindowsHookEx to cancel this hook. But when I want to install the hook again, the function SetWindowsHookEx returns NULL. If I close my program, which installed and canceled the hook just now, and restart it, it will work the first time I install the hook, but fail again at the second time.

Anybody knows what the problem is?
And how to fix it?

Thanks a million.