Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

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

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
cuziyq
Asked:
cuziyq
  • 6
  • 4
1 Solution
 
jkrCommented:
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
 
cuziyqAuthor Commented:
I added the line #define _WIN32_WINNT 0x501 as the very first line of the main file.  It still doesn't work.
0
 
jkrCommented:
Have you tried the project settings also?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
cuziyqAuthor Commented:
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
 
cuziyqAuthor Commented:
Actually, I put it in the Preprocessor Definitions on the project properties.  That's the correct place, right?
0
 
jkrCommented:
Hmm, I missed that there's a '_WIN32_IE', too. Try also adding

#define _WIN32_IE 0x400
0
 
cuziyqAuthor Commented:
Ya, I noticed that myself in the cmmctrl.h file.  I added #define _WIN32_IE 0x501.  Tried 0x400 too.  Still no go
0
 
jkrCommented:
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
 
cuziyqAuthor Commented:
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
 
cuziyqAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now