Trying to traverse a Popup menu - getting an unexpected submenu parent

Giganews Newsgroups
Subject: Trying to traverse a Popup menu - getting an unexpected submenu parent
Posted by:  R.Wieser (addre…@not.available)
Date: Thu, 4 Apr 2019

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

Replies