• Advertisement
Sign in to follow this  

Extended common controls

This topic is 4433 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I have decided not to use WxWidgets and to program only for Windows. I have a problem, though. When I initialize the common controls, my compiler doesn't recognize InitCommonControlsEx() nor INITCOMMONCONTROLSEX nor ICC_STANDARD_CLASSES but it recognizes ICC_TAB_CLASSES (wonder why :lol: ) which is a little bit disturbing because I include windows.h, commctrl.h and I link comctl32.a. Do you guys have any idea why my compiler bugs me like that ?
IControl::IControl() : enabled(true)
{
    INITCOMMONCONTROLSEX icc = { 0 };
    icc.dwSize  = sizeof(icc);
    icc.dwICC   = ICC_TAB_CLASSES;
    InitCommonControlsEx(&icc);
}



A friend solved my problem over MSN by adding "#define _WIN32_IE 0x0300" but could someone explain why and were to find a reference where it says when it is needed to define a value such as this one ? I looked up on MSDN but couldn't find it.

Share this post


Link to post
Share on other sites
Advertisement
This stuff isn't available on older versions of Windows*, so when you define that symbol you're basically saying 'I'm going to run this on a later version of Windows, I don't care about the older versions that don't support common controls, so let me do it and give me access to those structs and functions.'

*Specifically, you need Windows 95, which is old enough, but with IE 3 installed, which didn't come installed by default on Win95, so there's a chance that someone might not have it. If you run your app on such a computer you'll get some error, probably a missing DLL popup.

Share this post


Link to post
Share on other sites
More specifically, in Commctrl.h, the INITCOMMONCONTROLSEX is defined when:
#if (_WIN32_IE >= 0x0300)
typedef struct tagINITCOMMONCONTROLSEX {
DWORD dwSize; // size of this structure
DWORD dwICC; // flags indicating which classes to be initialized
} INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;


There're some more stuff that requires higher version of a particular library:
#if (_WIN32_IE >= 0x0400)
#define ICC_INTERNET_CLASSES 0x00000800
#define ICC_PAGESCROLLER_CLASS 0x00001000 // page scroller
#define ICC_NATIVEFNTCTL_CLASS 0x00002000 // native font control
#endif
#if (_WIN32_WINNT >= 0x501)
#define ICC_STANDARD_CLASSES 0x00004000
#define ICC_LINK_CLASS 0x00008000
#endif

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement