Search code examples
c#outlookoutlook-addin

i want to when user change theme on outlook so instantly change color of task pane and window element like text box, label


I want to when the user changes the theme in outlook so how to instantly change color of the task pane and window elements textbox, label etc.


Solution

  • The Outlook object model doesn't provide anything for that.

    You can read the current Office theme in the following windows registry key:

     HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\Theme
    

    where 15.0 stands for Office 2013 and means the Office version.

    The values are:

    Blue: 1

    Silver: 2

    Black: 3

    Also Office applications send the WM_MSO_BROADCASTCHANGE message to their top level windows when the current theme is changed. You can register a window for receiving such message using the RegisterWindowMessage function provided by Windows API. See WM_MSO_BROADCASTCHANGE value for more information.