Re: Windows Theming
"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:uKCkfL1JKHA.4316@TK2MSFTNGP04.phx.gbl...
Okay, I have an app I'm developing in rather a convoluted setup: I'm using
VPC to develop it on a Windows 2003 machine from my XP laptop.
So far so good. But when I try to run the application on XP or Vista, my
listview headers still appear in the same old gray, 3D look.
I assume this is related to the manifest, and that there are manifests for
XP and Vista, but how do I make it look current on Windows 2003, XP,
Vista, Windows 7, and beyond? (And why isn't that the default?)
Do I need to create the manifest by hand? Does anyone have a good
understanding of this?
When you create a new MFC project in VC2005, it generates stdafx.h with
these lines at the bottom of it:
---
#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
---
which should be enough for you to get a manifest embedded into your .exe
saying it depends on Common Controls 6.
The other thing you must make sure of doing is in your
CDerivedApp::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);
-- David