I have an MFC application written with VC6. I have upgraded it to VS2015 and it builds and runs. The application is a main exe with many DLL's that have dialogs in them.
However the application still looks like it is built with VC6. None of the GUI components have the Windows 7 look and feel, they all still look old style.
How can I make my existing application look more modern?
The first version was released in 1992. Although it has long been succeeded by the . NET environment as the most widely-used Windows development framework, MFC is by no means 'dead'. It is likely to be found in some older legacy code bases, and it's still being developed and supported by Microsoft.
Microsoft Foundation Class Library (MFC) is a C++ object-oriented library for developing desktop applications for Windows. MFC was introduced by Microsoft in 1992 and quickly gained widespread use. While Microsoft has introduced alternative application frameworks since then, MFC remains widely used.
Using modern GUI frameworks, it is possible to deploy new user interface components into a frontend with richer experiences in a fraction of the time it takes to do equivalent widgets in C++, making MFC as a Windows GUI framework deprecated.
You can create MFC or ATL programs with Visual Studio Community Edition or higher. The Express editions do not support MFC or ATL.
You should at least add this line to your project, for example add it to stdafx.h
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
Or add the following to your manifest file:
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
See also Enabling Visual Styles
It gets more complicated for owner draw controls. See this reference: Using Visual Styles with Custom and Owner-Drawn Controls
For ListView and TreeView controls, you can call this function for a more modern look (although it doesn't make any difference in Windows 10)
SetWindowTheme(m_ListView.m_hWnd, L"Explorer", NULL);
SetWindowTheme(m_TreeView.m_hWnd, L"Explorer", NULL);
* #pragma comment
is Visual Studio specific. For other compilers you need to modify the manifest file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With