This Knowledge Base article <http://support.microsoft.com/kb/830033>
describes how to apply Windows XP themes to Office COM add-ins. However,
this article has not been updated since Visual C++ version 6. I have been
trying to apply it in Visual C++ 2008 without success.
In part, the article says
"Add the manifest file to your resource file, as in the following example:
#include "windows.h"
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "mydllname.dl.manifest"
What "resource file" is that referring to? I don't know of any "resource
files" that include windows.h. Putting it into my project's .rc file either
has no effect or produces "fatal error CVT1100: duplicate resource",
depending on where within the .rc file it is placed.
I also tried using this new pragma to get the linker to add the required
manifest section:
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
language='*'\"")
This succeeded in adding the section to my add-in's embedded manifest file,
but there is still no change to my buttons appearance. Should this work in
Word 2007?
--
Scott McPhillips [VC++ MVP]
> This Knowledge Base article <http://support.microsoft.com/kb/830033>
> describes how to apply Windows XP themes to Office COM add-ins.
> I have been trying to apply it in Visual C++ 2008 without success.
> ... I also tried using this new pragma to get the linker to add the
> required manifest section:
> #pragma comment(linker,"/manifestdependency:\"type='win32'
> name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
> processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
> language='*'\"")
How does your manifest look like and which ID does it have? The ID
should be 2 as it is a dll manifest.
An addin of mine uses this manifest and the common controls work:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.2.3.4" processorArchitecture="X86"
name="my Addin" type="win32"></assemblyIdentity>
<description>my addin</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df" language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
</assembly>
In addition I add this to my code:
INITCOMMONCONTROLSEX iex = { sizeof(INITCOMMONCONTROLSEX),
ICC_COOL_CLASSES|ICC_STANDARD_CLASSES|ICC_TAB_CLASSES|ICC_USEREX_CLASSES };
InitCommonControlsEx(&iex);
--
SvenC
Thanks, Sven. It's good to know that it can work :)
Yes, I have InitCommonControlsEx. I don't see an ID anywhere and don't see
any documentation about an ID. This is what I am getting for a manifest
file (embedded by VS2008 using the #pragma
comment(linker,"/manifestdependency....)
<?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.DebugCRT"
version="9.0.21022.8" processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.ATL"
version="9.0.21022.8" processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
processorArchitecture="x86" publicKeyToken="6595b64144ccf1df"
language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
> Yes, I have InitCommonControlsEx.
I guess you call it as early as possible?
> I don't see an ID anywhere and don't see
> any documentation about an ID.
I meant the resource ID. Just open your dll with Visual Studio as resource
file.
You should see an RT_MANIFEST section with hopefully one entry named 2.
A manifest with ID 1 is for exe files, ID 2 is for dll files.
> This is what I am getting for a manifest
> file (embedded by VS2008 using the #pragma
> comment(linker,"/manifestdependency....)
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
...
The manifest itself looks good to me.
--
SvenC
Thanks for the info Sven. Yes, that all looks good: when I open the DLL I
see the RT_MANIFEST with a 2 and I see the common controls dependency in
there with the binary viewer, but alas, still no pretty buttons.
I use only property sheets in the Office COM Addin and its tabs and buttons
are shown in XP style.
How do you create the buttons which do not get XP themed?
Custom dialogs in an RC file?
--
SvenC
Yes, just very ordinary dialog templates in an RC file. And for controls I
have only buttons, edits, statics and one tab.
>> How do you create the buttons which do not get XP themed?
>> Custom dialogs in an RC file?
>
> Yes, just very ordinary dialog templates in an RC file. And for controls
> I have only buttons, edits, statics and one tab.
Strange. If you want you can send me your dialog definition and the
code how you create the dialog then I will add it to my addin and see
how it displays.
--
SvenC
"SvenC" <Sv...@nospam.nospam> wrote in message
news:%23CVvqsr...@TK2MSFTNGP05.phx.gbl...
--
Scott McPhillips [VC++ MVP]
Just for the records, as we solved this offline:
Deriving a dialog from CAxDialogImpl prevents XP theming.
If possible, use CDialogImpl instead.
--
SvenC
"SvenC" <Sv...@nospam.nospam> wrote in message
news:Ooaer63r...@TK2MSFTNGP06.phx.gbl...
> Just for the records, as we solved this offline:
>
> Deriving a dialog from CAxDialogImpl prevents XP theming.
> If possible, use CDialogImpl instead.
>
> --
> SvenC
--
Scott McPhillips [VC++ MVP]