• Advertisement
Sign in to follow this  

win32 Common Controls (Listview problem)

This topic is 3897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Everyone, I'm trying to create a ListView control using win32 and COM. I have the control created just the way I like, but I wanted to add two styles to it...well Extended styles, I wanted the grid lines style and the full row select: LVS_EX_FULLROWSELECT LVS_EX_GRIDLINES The problem is, when I try to put those two styles, it says LVS_EX_FULLROWSELECT and LVS_EX_GRIDLINES aren't defined. Is there anything I have to do to be able to use those styles? I checked commctrl.h to see if it was defined in there, and it is. I just don't know why its not working. Any suggestions? Thanks Gavin

Share this post


Link to post
Share on other sites
Advertisement
What functions are you calling to set the style on the listview?

IIRC you can't have "FULLROWSELECT" unless the listview is set to "REPORT VIEW".

Share this post


Link to post
Share on other sites
I do have it on report view, but my program doesn't even compile saying that the FULLROWSELECT thing isn't defined

Share this post


Link to post
Share on other sites
As per the MSDN documentation, LVS_EX_GRIDLINES is only available in commctrl versions 4.7 and up. To ensure that your program will run on all versions of windows, Visual Studio sets up your header files such that stuff that's only available on more recent windows versions won't compile. (you'll see that in commctl.h, LVM_EX_GRIDLINES should be wrapped in an #if directive that checks the version number). You can change the version number your app compiles with (probably in your stdafx.h?) to get this to compile.

Share this post


Link to post
Share on other sites
Good point, phil_t.

Also... make sure you create at least one column for report view, or nothing will be displayed at all.

Share this post


Link to post
Share on other sites
Most of the extended styles (including yours) are defined when _WIN32_IE define is at least 0x300, and some others are defined only when it's at least 0x400. I've also noticed that at the beginning of my COMMCTRL.H header, if _WIN32_IE isn't defined, it would be there defined automatically to 0x400, that's why my compiler does recognize all the extended stuff. Either your program defines _WIN32_IE to less than 0x300 somewhere before you include the header file (or the compiler defines it for some reason), or the header file is in an older version. By the way, what windows do you have?

Share this post


Link to post
Share on other sites
Quote:
Original post by UriKiller
Most of the extended styles (including yours) are defined when _WIN32_IE define is at least 0x300, and some others are defined only when it's at least 0x400. I've also noticed that at the beginning of my COMMCTRL.H header, if _WIN32_IE isn't defined, it would be there defined automatically to 0x400, that's why my compiler does recognize all the extended stuff. Either your program defines _WIN32_IE to less than 0x300 somewhere before you include the header file (or the compiler defines it for some reason), or the header file is in an older version. By the way, what windows do you have?


I'm using windows XP and I'm using Dev C++ with whatever compiler it comes with.

I tried defining _WIN32_IE to be 0x0400, but it didn't do anything.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement