Solved

#define'd identifiers in CommCtrl.h not playing nicely

Posted on 2007-11-16
10
243 Views
Last Modified: 2013-12-14
Using VC++ .NET 2002.

As far as I can tell, I have #included CommCtrl.h correctly in my program.  But some (not all) of the #define'd identifiers in that header cannot be found by the compiler.  For example:

comCtl.dwICC=ICC_STANDARD_CLASSES | ICC_LISTVIEW_CLASSES;

The compiler swears ICC_STANDARD_CLASSES is undefined, but it does understand ICC_LISTVIEW_CLASSES.  Also, when using the ListView control, LVS_EX_FULLROWSELECT and LVS_REPORT do not resolve, but WV_LISTVIEW does.

Now, to add a kicker to it . . . IntelliSense does resolve them properly when I hover over them with the mouse.  Also, if I use the DWORD value for these supposedly undefined identifiers, (0x00004000 instead of ICC_STANDARD_CLASSES), the program compiles and runs just fine.

I have tried cleaning the project and rebuilding.  No luck.  I even manually deleted the IntelliSense database thinking that might have something to do with it.  No luck.

What's going on here?  It's not critical, but it's annoying as hell and making my code very hard to read.
0
Comment
Question by:cuziyq
  • 6
  • 4
10 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 20299663
The declaration is compiled conditionally:

#if (_WIN32_WINNT >= 0x501)
#define ICC_STANDARD_CLASSES   0x00004000
#define ICC_LINK_CLASS         0x00008000
#endif

Add a

#define _WIN32_WINNT 0x501

before

#include <commctrl.h>

or specify that in your project settings.
0
 
LVL 14

Author Comment

by:cuziyq
ID: 20299728
I added the line #define _WIN32_WINNT 0x501 as the very first line of the main file.  It still doesn't work.
0
 
LVL 86

Expert Comment

by:jkr
ID: 20299780
Have you tried the project settings also?
0
 
LVL 14

Author Comment

by:cuziyq
ID: 20299816
Yup.  It is in both (although I get a compiler warning that it's being redefined if I leave it in the source file).
0
 
LVL 14

Author Comment

by:cuziyq
ID: 20299825
Actually, I put it in the Preprocessor Definitions on the project properties.  That's the correct place, right?
0
Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

 
LVL 86

Expert Comment

by:jkr
ID: 20299840
Hmm, I missed that there's a '_WIN32_IE', too. Try also adding

#define _WIN32_IE 0x400
0
 
LVL 14

Author Comment

by:cuziyq
ID: 20299918
Ya, I noticed that myself in the cmmctrl.h file.  I added #define _WIN32_IE 0x501.  Tried 0x400 too.  Still no go
0
 
LVL 86

Expert Comment

by:jkr
ID: 20300012
That's indeed odd - the following

#define _WIN32_IE 0x400
#define _WIN32_WINNT 0x501
#include <windows.h>
#include <commctrl.h>

void main () {

DWORD dwICC=ICC_STANDARD_CLASSES | ICC_LISTVIEW_CLASSES;

}

fails with VC7.x, yet compiles with VC8...
0
 
LVL 14

Author Comment

by:cuziyq
ID: 20300018
WTF?  I discovered that having the #define in there makes ICC_STANDARD_CLASSES work (I didn't notice before because I had it commented out and was just using 0x00004000 instead).  However, the LVS_* identifiers are still missing!  This is extremely frustrating.
0
 
LVL 14

Author Comment

by:cuziyq
ID: 20300867
Well, it definetly seems to be some kind of bug in VS .NET 2002.  This version of Visual Studio seems to have all kinds of subtle boogers in it.  Kinda leads one to an understanding of why the release lifetime for it was so short (VS2003 came out only 13 months later).  Can we say Windows ME?

Anyway, I have resolved everything by #defining the specific identifiers I need and ignoring the warnings by the compiler that I am redefining a macro.  I'll still give you the points, jkr, because you did lead me on the right path were it not for the crapware getting in the way.
0

Featured Post

Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now