• 0

[VC9, C++] Enable visual styles


Question

I give up, how do you get Visual Studio to enable visual styles for my C++ gui app?

I'm running Windows 7 x64 EN Home Premium, Visual Studio 2008 SP1 (fully patched), Windows SDK v7.0.

I'm building a C++ gui application, and all of the buttons and other controls display in classic style rather than aero style.

I've been googling and found something about modifying the manifest file to refer to ComCtl32.dll v6, but that doesn't seem like an ideal solution to me, surely there's a setting in visual studio somewhere...

HELP..... :(

Link to comment
https://www.neowin.net/forum/topic/816294-vc9-c-enable-visual-styles/
Share on other sites

11 answers to this question

Recommended Posts

  • 0

The easiest way to do it actually is with a manifest. It's a lot easier than it sounds.

Just make a comctl6.manifest and put something like this in it:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency> 
	<dependentAssembly> 
		<assemblyIdentity 
			type="win32" 
			name="Microsoft.Windows.Common-Controls" 
			version="6.0.0.0" 
			processorArchitecture="*" 
			publicKeyToken="6595b64144ccf1df" 
			language="*" 
		/> 
	</dependentAssembly> 
</dependency> 
</assembly>

Then just add it to your project (just drag it into the project in the solution explorer) and it will automatically be merged in when the executable is linked.

  • 0

^^ ok, will try that.

i found just another solution though, i pasted the following into my header file:

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' " "version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

thanks

  • 0
  hdood said:
Well, you can add a pragma, but it's not like the manifest file(s) is a hassle. It's write once, and you just add them to your new project. One for common controls, one for DPI, etc.

Uh, why suggest something so stupid? It's idiotic of you to suggest this option.

Going with pragma is a smarter option.

  1. One less dependency (as the manifest is embedded).
  2. It's faster (as the manifest is loaded from the program's resources as opposed to the file search/load option).

  • 0

It's really a matter of preference. I use the pragma comment, which for me is simpler. What was surprising to me was how long it took to figure out how to enable the visual styles. There's an MSDN article several pages long with confusing terminology when all it takes is a single line of code.

  • 0
  x0r said:
Uh, why suggest something so stupid? It's idiotic of you to suggest this option.

Going with pragma is a smarter option.

  1. One less dependency (as the manifest is embedded).
  2. It's faster (as the manifest is loaded from the program's resources as opposed to the file search/load option).

I think you're confused. The linker will automatically merge and embed any manifests that are part of your project. They don't become external files, they are embedded as resources. This is a pretty basic Visual Studio feature.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.