Solved

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

Posted on 2007-11-16
10
239 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
Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
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…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 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

15 Experts available now in Live!

Get 1:1 Help Now