Discussion:
XP Styles with Visual Studio 2005
(too old to reply)
Allan Phillips
2006-04-04 15:18:58 UTC
Permalink
I have a project that build an MFC application that includes a manifest file
via its .RC file.

The manifest file is included in the .RC file using the following lines:

// now include our WinXP Styles manifest
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST
"res/MyApplication.exe.manifest"

This works just fine in VS-2003. However, when I attempt to link the
application with VS-2005 I get a message stating that there are duplicate
manifests.

If I remove the include of my manifest file the link goes fine. It appears
that a manifest is built automatically. However, when it's finished the
resulting application doesn't use the XP styles.

Is there any way to get VS-2005 to build a manifest that includes XP styles
or is there a way to get VS-2005 to accept the manifest via the .RC file?

Thanks,
Allan.
Dave Anderson [MS]
2006-04-05 14:52:05 UTC
Permalink
I have used the following in x86 projects:

"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"

and the following in x64 projects:

"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'
language='*'"

in the project settings dialog under Linker | Manifest File | Additional
Manifest Dependencies.

Probably not the best approach, but it has been working for me.
Allan Phillips
2006-04-05 20:08:27 UTC
Permalink
Dave,

Do you mean to include that string inside an XML tag?

By the way, I find it hard to believe that VS-2005 doesn't support XP styles
without going through hoops. It seems as though XP styles are just not
expected to be used with VS-2005 which seems very strange to me. I would
have thought that XP styles would have been the default setting for VS-2005.

Thanks,
Allan.
Post by Dave Anderson [MS]
"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
language='*'"
"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'
language='*'"
in the project settings dialog under Linker | Manifest File | Additional
Manifest Dependencies.
Probably not the best approach, but it has been working for me.
Timo Kunze
2006-04-05 20:42:03 UTC
Permalink
Post by Allan Phillips
By the way, I find it hard to believe that VS-2005 doesn't support XP styles
without going through hoops. It seems as though XP styles are just not
expected to be used with VS-2005 which seems very strange to me. I would
have thought that XP styles would have been the default setting for VS-2005.
VS 2005 DOES support XP styles. It integrates everything directly into
your app by default.
In the linker settings go to "Manifest file". It should contain
something like "$(IntDir)\$(TargetFileName).intermediate.manifest". Also
make sure that the "Generate Manifest" option one line above is set to
"Yes".
Now go to the "Manifest Tool" options, set "Embed Manifest" to "Yes",
"Output Manifest File" to "$(IntDir)\$(TargetFileName).embed.manifest"
and "Manifest Resource File" to
"$(IntDir)\$(TargetFileName).embed.manifest.res".
These are the default settings of new projects and new projects have XP
style out of the box.

HTH
Timo
--
www.TimoSoft-Software.de - the home of ExplorerTreeView
Boycott DRM! Boycott HDCP!
Timo Kunze
2006-04-05 20:45:28 UTC
Permalink
One thing I forgot: Remove the manifest file from your resource script.
VS will generate one for you and embed it in its own resource file.

Timo
--
www.TimoSoft-Software.de - the home of ExplorerTreeView
Boycott DRM! Boycott HDCP!
David Lowndes
2006-04-05 22:36:02 UTC
Permalink
Post by Allan Phillips
By the way, I find it hard to believe that VS-2005 doesn't support XP styles
without going through hoops. It seems as though XP styles are just not
expected to be used with VS-2005 which seems very strange to me. I would
have thought that XP styles would have been the default setting for VS-2005.
A VS2005 MFC generated project has the following lines in stdafx.h:

#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#endif
#endif

Dave Lowndes
Allan Phillips
2006-04-06 13:39:07 UTC
Permalink
Thanks a lot, David.

Adding that to my stdafx.h solved the problem.

I assume that that is documented somewhere but I just didn't find it.

Thanks again,
Allan.
Post by David Lowndes
Post by Allan Phillips
By the way, I find it hard to believe that VS-2005 doesn't support XP styles
without going through hoops. It seems as though XP styles are just not
expected to be used with VS-2005 which seems very strange to me. I would
have thought that XP styles would have been the default setting for VS-2005.
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='x86' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df'
language='*'\"")
#endif
#endif
Dave Lowndes
David Lowndes
2006-04-06 15:05:51 UTC
Permalink
Post by Allan Phillips
Adding that to my stdafx.h solved the problem.
Great - it solved it for me too :)
Post by Allan Phillips
I assume that that is documented somewhere but I just didn't find it.
We can wish that anything about manifests and side-by-side is
documented in an easy to understand manner! ;)

Dave

Continue reading on narkive:
Loading...