Article View: borland.public.cppbuilder.nativeapi
Article #7993Re: Help with Message hook
From: KR
Date: Sun, 05 Dec 2004 14:48
Date: Sun, 05 Dec 2004 14:48
49 lines
2746 bytes
2746 bytes
I don't know if you can intercept these messages system-wide.
I would think you'd need to hook each individual window that uses
a menu. Is there some global message queue that can be hooked to
see *all* messages sent to every window/child window running on
the system? I don't think so.. and if so I would think it would
be terribly dangerous to use. I could be wrong, maybe there is.
On Sat, 04 Dec 2004 21:47:27 -0500, mike wrote:
> I have created a system wide windows message hook and I am trying to figure
> out how to detect when a menu is selected. Here is the code I am using
> right.
>
> LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
> {
>
> if( nCode < 0)
> {
> break ;
>
> return CallNextHookEx( hMsgHook,
> nCode,
> wParam,
> lParam) ;
> }
> if ( nCode == HC_ACTION)
> {
> CWPSTRUCT *cwpsParam =(CWPSTRUCT *) lParam;
>
> if ( cwpsParam->message == WM_MENUSELECT )
> {
> ......... do something
> }
> }
> return CallNextHookEx( hMsgHook,
> nCode,
> wParam,
> lParam) ;
> }
>
> So I thought I would get a hit on the WM_MENUSELECT if a menu item was
> selected from the windows menu, but I never see a hit.
>
> Could someone show me how to actually detect when a menu is selected in a
> global hook.
>
> Thanks for any help in this.
>
> Mike
Technical Details
Message-ID:
<pan.2004.12.05.14.48.04.504749@nospamme.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41b2766c$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,21323583e8de481a X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: KR <kr@nospamme.net> Subject: Re: Help with Message hook Date: Sun, 05 Dec 2004 09:48:06 -0500 User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-ID: <pan.2004.12.05.14.48.04.504749@nospamme.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <41b2766c$1@newsgroups.borland.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.148.149.154 X-Trace: newsgroups.borland.com 1102257795 24.148.149.154 (5 Dec 2004 06:43:15 -0800) Lines: 50 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail