I recently migrated a project from VS2005 to VS2015. In doing so, my project now refuses to use the system look and feel and uses the windows 98 look and feel. When built in 2005 it does use the system appearance.
The .rc
file that describes the dialogs is identical as I copied and pasted the original one over. The properties are all the same.
I have searched around and one possibilty is the FlatStyle property, which can be set to system, however none of my dialogs have this property.
Furthermore, i have looked through this and tried the suggestions but none seem to work.
I believe the issue to be a setting I have to disable for 2015 so that the Application adapts to the system look and feel.
So how do I make my application adapt to the current system?
Here is an example of a dialog:
STYLE DS_SETFONT | DS_3DLOOK | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW
To allow your app to use visual styles, you need to specify that you want to use ComCtl32.dll
version 6 or later, through a manifest file. Windows ships with multiple versions of this file, so you need to specify you want a newer one.
Note also that, as @Mgetz mentioned in the comments, newer dll requires Unicode to work properly, so make sure Character Set is set to Unicode
in project's general properties.
You can generate the file yourself, or let Visual Studio generate it automatically according to the project dependencies and linker directives in your source code.
So, the easiest way would be to let linker generate it. Open Linker
properties for the project, select the Manifest
page, and make sure that Generate Manifest
is set to Yes
. Then place the following directive in your source code:
// broken into several lines for readability, as usual make sure there
// are no backspaces after trailing backslashes if copy/pasting
#pragma comment(linker, "\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
Alternatively, you can generate a manifest file manually. According to the Enabling Visual Styles article, it should look like this (the <dependency>
attribute is the relevant one):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>