Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!sgi!cdp!jeff From: jeff@cdp.UUCP Newsgroups: comp.windows.ms.programmer Subject: Re: Windows Hooks Message-ID: <1266500004@cdp> Date: 9 Apr 91 03:24:00 GMT References: <1823231@su92Z3w164w@ersys.uucp> Lines: 17 Nf-ID: #R:su92Z3w164w@ersys.uucp:-182323169:cdp:1266500004:000:700 Nf-From: cdp.UUCP!jeff Apr 8 20:24:00 1991 > I'm having a little trouble with hooks. I understand that all of the > hook code has to be out in a DLL. I've written the hook, I can get it > to work after installing it, but when I uninstall it, it sends my machine > into BRS land. Hard reboot time. When you invoke UnhookWindowsHook, your hook routine may be invoked one last time (with the first argument, nCode, set to -1). You must be prepared to handle this case: in particular, you must not call FreeProcInstance until the unhook is complete; and (as mentioned in the documentation) when you see that nCode is -1, you should invoke DefHookProc without doing any other processing. Jeff Dean jeff@cdp.igc.org uunet!pyramid!cdp!jeff