Solved

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

Posted on 2007-11-16
10
253 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 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Determining the an SCCM package name from the Package ID
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
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

724 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