[windev] Windows Hooks / Menus
Lori Falck
LoriF at HarveySoftware.com
Tue Mar 16 14:31:23 GMT 2010
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/attac
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
More information about the Windev
mailing list