Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Menu without causing loss of focus?

  • Please log in to reply
No replies to this topic
  • Guests
  • Last active:
  • Joined: --
Hello everyone.

What I want to achieve

Independent context menu for Windows Explorer files/folders.

The problem

Showing the menu (via "Menu, my_menu, Show") causes loss of focus of Windows Explorer. This causes the item selection in Windows Explorer to be hidden, so the visual aid/feedback of which items are selected is taken away.

While not vital for the functionality of the context menu, I would much rather keep the selection visible as it would be consistent with the Windows Explorer context menu(s) (and it seems much more user-friendly to me, too).

What I have tried so far

1.) Plain use of Menu command (without any further GUI). (Causes loss of focus.)

2.) Use of Menu command after creating a GUI; the GUI does not cause loss of focus by using:

WinGet, hwnd_progman, ID, Program Manager
Gui, 2: +Parent%hwnd_progman%
Gui, 2: +0x40000000 -0x80000000  ; Add WS_CHILD, remove WS_POPUP

(Based on http://www.autohotke...topic23240.html)

When showing the menu the focus is still lost.

3.) Use of Menu command after creating a GUI and setting its parent to Program Manager via DLL call to SetParent (based on http://www.autohotke.../topic8906.html).

Does anyone have a tip if and how this can be achieved?

Kind regards