0

I am currently trying to customize a context menu in Outlook. For the regulars I have had a series of issues which can be seen in this question and with this question.

I would like to adjust the background color a little.

        Dim hBrush As IntPtr = NativeMethodsEX.CreateSolidBrush(ColorTranslator.ToWin32(System.Drawing.Color.Red))                
        Dim mi As New NativeMethodsEX.MenuInfo

            With mi
                .cbSize = Marshal.SizeOf(mi)
                .fMask = NativeMethodsEX.MIM_STYLE Or NativeMethodsEX.MIM_BACKGROUND Or NativeMethodsEX.MIM_APPLYTOSUBMENUS
                .dwStyle = NativeMethodsEX.MNS_NOCHECK
                .hbrBack = hBrush
            End With

            NativeMethodsEX.SetMenuInfo(aHwnd, mi)

This code however produces this;enter image description here.

How can I also change the background of the left hand side or what even is the class name of that part of the window. Also it has a border as well. What is its class name or how can I either remove it or change it?

Community
  • 1
  • 1
darbid
  • 2,545
  • 23
  • 55
  • 1
    You will have to draw the entire menu as a custom drawn menu. – David Heffernan Dec 21 '16 at 08:20
  • The entire menu and functionality or can i intercept a message at some point in time when the window itself is being created? – darbid Dec 21 '16 at 09:56
  • 1
    Probably not going to be viable in an addin. Give it up. – David Heffernan Dec 21 '16 at 10:00
  • What happens when the user has chosen red as their menu text color? Your menus are completely unreadable, a show-stopper bug. Don't do this. Let the operating system control the theme, where it is customizable by the user. – Cody Gray - on strike Dec 21 '16 at 10:24
  • This is an example for the question. I wanted it to be clear what the problem was. I would be choosing a color that matches other menus in the application. These seem to be "system" menus whereas some of the other menus with richer content and allow customization have a slightly different color. – darbid Dec 21 '16 at 10:35
  • so a simple link to an example of doing what I want to do would be fine. @David - I hear you and I am almost there but not giving up just yet. – darbid Dec 21 '16 at 10:37
  • That's a quite different definition of the word "almost" from the one I know – David Heffernan Dec 21 '16 at 11:02
  • Well as you can see I have already hacked the Outlook window structure to find the right windows, built a wndproc, intercept message for the context menu, add text/image and intercept the resulting message. I now just would like it to look nice. It Christmas, Im doing this as a hobby not a job, give me some homework / reading David :-) – darbid Dec 21 '16 at 12:00

0 Answers0