I have an addin for Office 2007 which adds a toolbar with some buttons and handlers for their OnClick events. When the user clicks on the buttons, some dialogs show. But those dialogs have the dated Windows 98 look and feel with rectangular buttons, even on Windows 7.
I know that you need a manifest file to enable theming, but this addin is created with Visual Studio 2008 and it adds a manifest automatically which looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
What should I change to make my dialog use the current theme instead of Windows 98 look? I've read about isolation awareness, but that didn't seem to work either.
As you've discovered, adding the manifest is only half of the battle. You also need to call the InitCommonControlsEx
function when your add-in initializes, before any controls are created. This is necessary to register the window classes for the common controls you use.
And just in case you're skeptical of the documentation, Microsoft's Raymond Chen posted an article on his blog a while back addressing precisely this issue.
If you have any other issues, check this article: How to apply Windows XP themes to Office COM add-ins