I have a ListCtrl in one of the dialog of a mfc application. I want to change the column name style and the button style to look more like win7 themed. this is the old dialog with the listCtrl in right.
what I want to change the top row of the table and the buttons to something like this ,
can this be done by changing any style by doing m_ElementListCtrl.SetExtendedStyle(..) ? or chaning some of its properties ?
Hi If your app is Unicode(otherwise there is some problems) you need to use Common controls 6.
In your stdafx.h file you probably could see this kind of code , if no , just add it in the end of file, if you change your app to UNICODE you will see controls with new style.
#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_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
Also check Project Properties -> linker-> Manifest File-> Generate Manifest should be set on Yes (/MANIFEST)
Related
This question already has answers here:
An XP style combobox in a DLL
(2 answers)
Closed 6 years ago.
I need to use Windows Common Controls v6.0 to see new style UIs.
I know I can do it by a manifest dependency but when I haven't access to the manifest (or source code... it's not my app but I have a DLL which will be attached to the process and every CommCtrls I need will be called from that DLL) what should I do to specify Windows Common Controls version for that process? Is there any API or someway to do it?
[By the way, I'm using C++ & VS2015]
Try this in your DLL:
#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_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
I am trying to use the POCO C++ library in my existing Windows CE project on Visual Studio 2008.
I have compiled the POCO library using the provided .bat files. I used the one nammed build_CE_vs90.cmd and it successfully generated several .lib files.
However a header of the POCO library (Foundation.h) has a pragma to automatically link the right .lib file :
#if defined(_MSC_VER)
#if defined(POCO_DLL)
#if defined(_DEBUG)
#define POCO_LIB_SUFFIX "d.lib"
#else
#define POCO_LIB_SUFFIX ".lib"
#endif
#elif defined(_DLL)
#if defined(_DEBUG)
#define POCO_LIB_SUFFIX "mdd.lib"
#else
#define POCO_LIB_SUFFIX "md.lib"
#endif
#else
#if defined(_DEBUG)
#define POCO_LIB_SUFFIX "mtd.lib"
#else
#define POCO_LIB_SUFFIX "mt.lib"
#endif
#endif
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Foundation_EXPORTS)
#pragma comment(lib, "PocoFoundation" POCO_LIB_SUFFIX)
#endif
#endif
The problem is that POCO_LIB_SUFFIX is defined as "mtd.lib" and I have no "mtd" version of the lib in the directory where the .lib files are. I only have PocoFoundation.lib and PocoFoundationd.lib, but no PocoFoundationmtd.lib, which is causing an error while linking because the file is not found.
I have compiling my project using :
POCO_STATIC
POCO_NO_UNWINDOWS
I openned the build .bat script and it does contain the argument "static_mt" passed to the main build file :
#echo off
buildwin 90 build static_mt both WinCE samples
What am I missing ? Thank you.
You're compiling your project with DEBUG config, change it and undef POCO_STATIC (it's the MultiThread build), for some reason you compiled the shared version, that's why you've the .lib file without any suffix.
Hi I currently have a problem redefining _WIN32_WINNT even though I have
#define _WIN32_WINNT 0x0600
#define WINVER _WIN32_WINNT
in my stdafx.h it still defaults to 0x0603
I'm currently using DDSTextureLoader that came with DirectX Tutorials and by beeing 603 it uses CreateFile2 and not CreateFile which creates an error :(
Remove all the #defines in the header files, and add the preprocessor definitions -D_WIN32_WINNT=0x0600;-DWINVER=_WIN32_WINNT in the project configuration. This makes sure that the definitions take effect at the very beginning of the compiling process. For the details, see here.
If it's not appropriate to remove the #defines in the headers. You may change them to the following:
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0600
#endif
#ifndef WINVER
# define WINVER _WIN32_WINN
#endif
when ever am adding MFC SysLink Control to my application , it forces the application to close , am using VC++ 11 , and am just dragging a syslink control tool to my dialog box, any clue why it forces the app to close?
I had similar problem. SysLink requires Common Control 6.0 defined in the manifest. I solved it by adding the following line in the project
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
You must set Generate manifest=yes in the properties-linker-manifest files.
I tried using something like this to set the tool tip of a CMenu item (as described here) but it is just being displayed in a single line and the line break is not visible.
// read control id
UINT id = menu->GetMenuItemID(1235);
// modify caption and add tooltip?
menu->ModifyMenu( id, MF_BYCOMMAND, id, "Click here\nThis is the tooltip for the menu item ...");
I also tried to set the caption directly in the visual studio resource designer of the menu item with the same effect.
Can you give me any hints on whats wrong? I am using VS2008 on windows 7.
Any help is appreciated!
Perhaps you have not added the windows xp common controls to your application.
Try adding the common controls to your stdafx.h:
#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
Looks like an duplicate
Mainly you should use \r\n instead of \n because this is what mfc expects.