1

I am referring to this answer How to enable visual styles without a manifest

Doing what that answers says creates a .manifest and visual styles are enabled. However I don't want the manifest to be bounded with my .exe - I am delivering only my executable and would like everything bundled in there.

Is there a way to enable visual styles without manifest or maybe through embedding the manifest inside the executable itself?

Community
  • 1
  • 1
Luca Matteis
  • 29,161
  • 19
  • 114
  • 169

2 Answers2

5

Use mt.exe to embed the manifest into the executable as a resource. This is a standard part of the build since VS2005, use a project template if you have trouble setting it up properly.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
2

Add this to the end of 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

Alex F
  • 42,307
  • 41
  • 144
  • 212
  • This piece of code will create a .manifest and the executable will need it to enable visual styles. So if I move the executable somewhere else, I will lose visual styles. – Luca Matteis Feb 23 '11 at 18:05
  • Visual Studio embeds the manifest generated wuth this pragma with the default project settings. – Chris Becke Feb 23 '11 at 22:17