Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!cica!gatech!gitpyr!kyler From: kyler@pyr.gatech.EDU (J. Kyle Rogers) Newsgroups: comp.windows.ms Subject: Re: Windows Hooks and Message Filters Summary: why? ; i agree ; doing it right? Keywords: SetWindowsHook, message filter, IsDialogMessage Message-ID: <8854@pyr.gatech.EDU> Date: 26 Jul 89 18:56:05 GMT References: <385@secola.Columbia.NCR.COM> Reply-To: kyler@pyr.UUCP (J. Kyle Rogers) Organization: Technology Dynamics, Inc. Lines: 46 In article <385@secola.Columbia.NCR.COM> ramspott@secola.Columbia.NCR.COM (John Ramspott) writes: > > I am having trouble using the SetWindowsHook() routine with the >WH_MSGFILTER option. I am interested in trapping when the user hits the >help button on a dialog box, which is always control id 3 in my app. >What I am expecting to see is a WM_COMMAND message with a wParam of 3. Why can't you just trap the WM_COMMAND message within the dialog box function? If what you want is to trap events for the help button before anything makes it to the dialog box function, why not just subclass the help button? > [...] >The other complaint I have is an inaccuracy in the documentation. It claims >that the nCode your filter function will get is one of three values -- >MSGF_DIALOGBOX, MSGF_MENU, and MSGF_MESSAGEBOX, and ONLY one of these >three. Not true. You can also get MSGF_SCROLLBAR if you have a list box, >as well as some nCodes for resizing. > [...] I agree. The documentation is sketchy -- but then again, this stuff is practically Windows internals. >Finally, I often get two copies of a message for modeless dialog boxes sent >to my filter function. Any idea why?? I am currently recording the times >of messages and ignoring ones I get with no time elapsed. Are you using the modified message loop for modeless dialog boxes (suggested in lots of things I've seen)? (i.e. something like this -- off the top of my head: while (GetMessage (...) ) { if (modeless dialog box present and !IsDialogMessage (...) ) { TranslateMessage (...) DispatchMessage (...) } } ) Check the SDK Prog. Ref. Functions Overview or the Petzold book for more info. >John E. Ramspott, NCR, SE-Columbia. Usenet: ramspott@columbia.NCR.COM | krogers -- J. Kyle Rogers -- Technology Dynamics Inc. | | 145 15th Street N.E., Suite 624 -- Atlanta, GA 30361 | |uucp: ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!kyler| |ARPA: kyler@pyr.gatech.edu |