Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-16
10
Medium Priority
?
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 750 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

598 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