I spent ages trying to figure out how to hook the IDE project treeview. I managed it, but it only works in debug. When I build my app and run it, hooking kills the IDE.

I suspect the problem is in my SetWindowsHookEx call, but I can't figure out what I'm doing wrong.

Anyone who knows about hooking want to have a look at it for me?