Alt

Pressing ALT in my app makes a hidden Windows system menu activate (Restore, Move, Size, Minimize, Maximize, Close) which is not shown until I press arrow up or down. How can I turn off this “feature” ? I just want ALT to do nothing.

Wow, don’t know… that’d probably require some deep win32 voodoo. I do know that the hidden menu needs to be there, otherwise the window doesn’t work properly, so we’d need to somehow prevent the alt key from reaching it.

I did it like this, by disabling the WS_SYSMENU flag of the main window:

#if JUCE_WINDOWS LONG val=GetWindowLong((HWND)getPeer()->getNativeHandle(), GWL_STYLE); SetWindowLong((HWND)getPeer()->getNativeHandle(), GWL_STYLE, val & ~WS_SYSMENU); #endif

Is there a reason why JUCE enables this flag? I hope my solution doesn’t break anything?
PS: I realize that WM_SYSMENU needs to be enabled when using a native titlebar, because otherwise the titlebar will be empty (no buttons etc…). I am not using a native titlebar.

Yeah, that’s what I meant when I said the hidden menu needs to be present. Many years ago when I first wrote that code, I also disabled that flag, which seemed sensible, but there were lots of subtle problems with windows failing to behave correctly. E.g. I think it was impossible to minimise or maximise them without the menu being there, and other misc problems.

So far no problems here, again I want to stress out that I’m using a JUCE window, not a native one. Anyway, if I (or testers) run into problems, I’ll let you know.

Yes, I understand. But although your app might not have any problems, I’m pretty certain that’d break things for other people, in subtle and rare cases. For me to add an official fix for your alt problem, it’d need to be done in a different way…