Click here to Skip to main content
15,889,830 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi,

I have been migrating my old VC++ 6.0 application to Visual Studio 2005 for Windows 7. It's Functioning well. I have googled and added the below code to "StdAfx.h" to change the UI look like windows 7,

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


But, Still the background of dialog boxes,toolbar and menu bars are in the same old style. I want to make the entire application with win 7 look and feel. is there any way to apply the win 7 theme for the entire application????
Posted

1 solution

I guess you need XP-style controls for your controls. To get XP-Style controls, you have to do the following things.
In StdAfx.h add the following lines.

C++
#ifdef _UNICODE
#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
#endif


And InitInstance() of App class you should call InitCommonControlsEx().

C++
App::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);
}


http://msdn.microsoft.com/en-us/library/windows/desktop/bb773175%28v=vs.85%29.aspx
 
Share this answer
 
v2
Comments
EshwarTamil 2-Nov-12 1:06am    
I already tried out this code.This is not working for all controls.I need to bring a Windows 7 look for my application.is there any other way for this????
Santhosh G_ 2-Nov-12 1:36am    
MSDN link may help you.
I also faced this issue in my application, when converting VC6 app to VC7, controls style is not changed.
We got XP style controls, buttons, radio button, edit controls etc by applying above things.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900