Discussion:
Trying to traverse a Popup menu - getting an unexpected submenu parent
(too old to reply)
R.Wieser
2019-04-04 11:42:52 UTC
Permalink
Hello all,

I'm trying to programmatically select items from a popup menu, and have a
bit of a problem with submenus: I'm getting an unexpected result in regard
to its parent:

(partial) EnumerateWindows result:
Ctl:002900EE Par:00200144 '#32768' '' <-- Submenu
Ctl:001F00DC Par:00000000 '#32768' '' <-- Main menu
Ctl:00200144 Par:00000000 'ExploreWClass' 'My Documents' <-- Dialog

Can anyone explain to me why the submenu's parent (GetParent or
GWL_HWNDPARENT) is the dialog, and not the main menu - or zero, just like it
? Or why the submenu points to the dialog, but the main menu does not ?
It doesn't make sense to me. :-(

Regards,
Rudy Wieser
Christian Astor
2019-04-05 21:39:21 UTC
Permalink
I'm trying to programmatically select items from a popup menu, ...
The standard method is to use IUIAutomation
(Inspect tool from Windows SDK to get the hierarchy of controls)
R.Wieser
2019-04-06 07:25:07 UTC
Permalink
Christian,
Post by Christian Astor
The standard method is to use IUIAutomation
I read about it. But I stopped pursuing it when it became clear that I
would need to install a hefty package - just to be able to automate an item
once or twice in the 'puters lifetime. Also, my current traversing of a
popup menu works, using straight API calls.

But do you have/know anything in regard to the dialog, menu, submenu
ownership oddity I spoke about ? I'd like to understand how/why it works
that way.

And re-reading my initial question I see I forgot to mention the OS. Its
XPsp3.

Regards,
Rudy Wieser

Loading...