[windev] Windows Hooks / Menus
Lori Falck
LoriF at HarveySoftware.com
Tue Mar 16 19:28:53 GMT 2010
Apologies, but my post from earlier was a bit of a false alarm. This isn't
my project (I'm helping my hubby since I do way more C++ than he does) and
the window he actually needs to get the menu for he can.
Of course he just called me to let me know it DOES work on the needed
windows, but... it blows up now when he processes the menu click. So I know
what I'll be looking at tonight...
Thanks for reading,
Lori
-----Original Message-----
From: Little, David [mailto:david.little at intergraph.com]
Sent: Tuesday, March 16, 2010 11:14 AM
To: Lori Falck; Windev
Subject: RE: [windev] Windows Hooks / Menus
You can use Spy++ to see what the menu is - do a "Find Window" and drag
the finder tool over the menu on the app you're trying to hook. Whether
or not you have any exposed APIs/hooks is another matter, but you can
use Depends.exe for that. DevEnv.exe uses MsoCommandBar, iTunes just
uses static text for its menu, IE uses ToolbarWindow32.
-----Original Message-----
From: windev-bounces at windev.org [mailto:windev-bounces at windev.org] On
Behalf Of Lori Falck
Sent: Tuesday, March 16, 2010 9:31 AM
To: 'Windev'
Subject: Re: [windev] Windows Hooks / Menus
OK, so we wound up using WM_COMMAND and have this thing working
flawlessly.
We can launch an application, grab the window's menu handle, add an item
to
it, and capture/process click events on that particular menu item.
But... (of course there is a but)
The target application doesn't appear to use standard Windows menu
controls.
::GetMenu() returns NULL
So we can either:
1) Go to plan B and attach to the System Menu of the application
2) Go for a context menu (there does not appear to be one currently)
3) Try to tackle whatever they are using for the menu - It could be a
MenuBar, but we aren't sure yet
I guess my question to you all is - is it worth the time to keep digging
into the main menu? Is there hope?
Does anyone have any experience tapping into a CMenuBar in another
application? Is there anything else it might be?
Thanks!!
Lori
-----Original Message-----
From: windev-bounces at windev.org [mailto:windev-bounces at windev.org] On
Behalf
Of Tim Lesher
Sent: Monday, March 08, 2010 1:09 PM
Cc: Windev
Subject: Re: [windev] Windows Hooks / Menus
On Mon, Mar 8, 2010 at 12:41, Lori Falck <LoriF at harveysoftware.com>
wrote:
> Ideally, we'd like to find the target window and thus it's calling
thread,
> and set a hook on that thread only. We've got a DLL that sets the
hook on
> WH_MSGFILTER and have it working on a Notepad window - at least we get
into
> the callback function when a menu is activated in Notepad (for proof
of
> concept). Now we just need to figure out the parameters and work with
> them.
> And ultimately only process the message when a certain menu item is
> clicked.
>
>
That's exactly how I'd do it.
> Will WH_MSGFILTER allow us to get the item that was clicked on, or
will it
> just fire when the menu is shown?
>
Your message hook proc should get exactly the MSG structure that will be
unpacked and sent through the window proc chain, so it includes
everything
you need to decipher it.
Caveat: I haven't used this feature since before Vista, so I don't know
how
or if the added security features there have changed the way it works.
--
Tim Lesher <tlesher at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.windev.org/pipermail/windev/attachments/20100308/81f60bce/a
ttac
hment.htm
--
Windev mailing list at Windev at windev.org
Lost your password? Need to unsubscribe or change your delivery
options?
Go to http://lists.windev.org/mailman/listinfo/windev
--
Search the Windev Archives - www.windev.org
--
Windev mailing list at Windev at windev.org
Lost your password? Need to unsubscribe or change your delivery
options?
Go to http://lists.windev.org/mailman/listinfo/windev
--
Search the Windev Archives - www.windev.org
More information about the Windev
mailing list