How to apply WinXP Look&Feel to Outlook Addin Property Page, ATL/C

P

PaoloC

Hi,

I have to complete an Outlook Addin developed with ATL/COM and I'm new to
Visual C++ and windows development.

The current problem is the look&feel in the Addin Option Page. In Outlook,
Tools -> Options... a new tab for the Addin is inserted. However, its look
and feel is different from the other tabs: it looks like it has the win98
style instead of the Windows XP style.

Do you have any idea?

I'm running WinXP and Outlook 2003. The IDE is Visual Studio 2005 pro.

Thanks,
Paolo
 
K

Ken Slovak - [MVP - Outlook]

You have to enable theming in your code for the property page to have a
Windows themed look.

I have no idea how to do that in ATL/C++ code. You can google for theming
code for C++, there are probably examples of that on the Web. I've only
worked with that in VB 6, in that code I work with either the UxTheme Win32
library or activation contexts.

In managed code with at least Framework 2.0 you just use a line like this to
theme your code:

System.Windows.Forms.Application.EnableVisualStyles();
 
P

PaoloC

Hi,
You have to enable theming in your code for the property page to have a
Windows themed look.

I'm looking around and I found that declaring a manifest like the following
people is able to have WinXP theme. However, in my case it seems that only a
subset of the theme is loaded. Specifically, it seems that the controls are
conform to the theme, whereare the rest, like background and fonts, are not.

Here a sample manifest to include in the project.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<description>[description]</description>

<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.1.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

Thank you,
Paolo
 
K

Ken Slovak - [MVP - Outlook]

You have to do what I said to begin with. If a manifest did everything I
would have mentioned it. In addition, if you want the background to match,
including gradient, you have to find the background color and gradient
applied and use that.




PaoloC said:
Hi,
You have to enable theming in your code for the property page to have a
Windows themed look.

I'm looking around and I found that declaring a manifest like the
following
people is able to have WinXP theme. However, in my case it seems that only
a
subset of the theme is loaded. Specifically, it seems that the controls
are
conform to the theme, whereare the rest, like background and fonts, are
not.

Here a sample manifest to include in the project.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<description>[description]</description>

<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.1.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

Thank you,
Paolo
 
P

PaoloC

Hi Ken,
You have to do what I said to begin with. If a manifest did everything I
would have mentioned it. In addition, if you want the background to match,
including gradient, you have to find the background color and gradient
applied and use that.

I'm able to set the color, forcing it to a specific constant value. However,
because I have to set the color according to the system, do you know how
to retrieve the default values for colors? I did an attempt to retrieve them
from
a parent class, but it returns me the wrong value. I would like to find a sort
of system constant or to access system properties.

Thank you,
Paolo
 
K

Ken Slovak - [MVP - Outlook]

I'm not sure about that, it's something you'll have to research. The best
results I get are when I pick a point in the background and read that pixel
color.
 
D

Dmitry Streblechenko

As Ken mentioned, you need to use the theming API to draw your controls and
tehe window background.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
P

PaoloC

Hi Ken and Dmitry,

Sorry for the absence. Thank you a lot for your posts. I found
a post on an MS blog where it is stated that MS recommends
to develop a different add-in for each Office version 2007,
2003 and previous.

In my case, the background is not a system color: it seems to
be a blend of at least two colors. Moreover, as you stated, there
is also a gradient.

Theming API, in my case, should means UxTheme. I'm reading
it but it seems that it requires a different approach with respect
to the current one. And I'm not sure I can follow it right now.

Thank you again,
PaoloC
 
K

krish

Hi I have the same problem you have faced. I am using VS 2008. ATL/COM addin
for Outlook. How did u overcome it. I found the Windows common controls in
the dll resource after Building my project. but I am not getting the XP
theme.


Please any one help me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top