Using only Win32 C++ (no WTL or MFC or any other third-party library), how can I get custom menu borders?
I was able to ownerdrawn the items but the borders are in the Non Client area and I was unable to find a way change them.
Is there a way?
No matter how you implement this it is going to be a bit of a hack.
One option is to forget about HMENUs and build your own menus with a custom always on top window. This is probably way too much work and you will never get everything perfect. Just off the top of my head you have to deal with LTR vs. RTL, accessibility, configurable settings like the shadow and menu animations (sliding/fading). There are probably things SetMenu
does to a HWND that you cannot replicate with a hack like this but you can sidestep that issue by implementing it in a rebar.
If you want to keep using HMENUs then you have to use SetWindowsHookEx to find the menus HWND. The menu class is #32768
. You can then subclass the window and override the WM_NC* and WM_PRINT* messages. This Codeproject article also has information about a undocumented message (0x01e5) you need to handle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With