0

I have just updated a vs2010 mfc app to vs2012 and I have problems where the new shiny style windows buttons and progress bars are not appearing, they show as Windows 2000 style buttons.

I have the following code in my stdafx.h file:

#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

I am calling InitCommonControlsEx and I should not need a manifest file as far as I understand to get the new style to appear. Any ideas?

elSeten
  • 38
  • 1
  • 8
  • Are you sure that the manifest is created? As you see in your code you have an conditional compilation... usually _M_IX86 is defined but... – xMRi Oct 16 '13 at 08:22
  • Pretty sure. The code #pragma comment is not 'grayed out' on that line so _M_IX86 is defined. I did change from non-unicode to unicode when upgrading the project to vs2012. Would that play a role here? – elSeten Oct 16 '13 at 22:54
  • I have found a work around. In my project settings, the Platform Toolset was set to "Visual Studio 2012 - Windows XP (v110_xp)". I changed this to "Visual Studio 2012 (v110)", but only after putting in a manifest file stating `` in the exe directory would the correct styles load for buttons and progress controls. – elSeten Oct 17 '13 at 02:07

1 Answers1

0

I'm late to the game, but for me the problem was a small linker setting called /ALLOWISOLATION (description here).

This linker setting has to be set to Yes otherwise manifests will not even be considered. And no manifest means the v5.82 common controls DLL will be loaded instead of the v6 version.

You can see from the debugger module load/unload messages if this applies to you (the version number is logged along with the entry).

The strange thing is that the application still appeared 'half themed'. E.g. you could cycle through the XP and Office themes but for instance a button would be devoid of any modern styling. Probably a different DLL (uxtheme?).

Also images from an image list would appear jagged (no alpha channel even though the icons were strictly 32bpp).

E. van Putten
  • 615
  • 7
  • 17