Reputation: 24457
How is autohide implemented in win32 ? I have a menu in my application which I can hide with SetMenu( hwndDlg, NULL )
and I can re-enable it with SetMenu( hwndDlg, hMenu )
however I want to mimic the behaviour many modern applications have (such as IE9) where the menu is hidden till you press Alt. Then when the main window becomes focused the menu goes away again. Is there a standard API to do this ? Alternatively I could check for the focus and Alt button.
After some investigating with Spy++, I am able to show the menu on handling WM_SYSCOMMAND with SC_KEYMENU but still not sure what message to handle to make the menu go away.
Upvotes: 1
Views: 711
Reputation: 14498
So you just want to know when the user is done with the menu so you can hide it again?
If so, try the WM_EXITMENULOOP message.
Apparently the app gets WM_ENTER/EXITMENULOOP for both the regular app menu, the system menu, and any 'TrackPopupMenu' menus, so you may get this when the regular menu is already hidden (eg. if the user access and dismisses the system menu).
Upvotes: 1