Monday, April 13, 2009

Fun with the ListView Control/MHColour 2009 another update

You've just gotta love Microsoft documentation. Well, actually you don't. In fact you must despise it with every fiber of your being until it becomes a defining purpose for your life. Or something.

Anyway, in working on the UI for MHColour 2009, I wanted to add some features like groups and a highlighted first column. Seems simple enough, so here we go; use ListView_InsertGroup for the former and ListView_SetSelectedColumn for the latter. Compile it; oops - unresolved external. OK, check them up on MSDN again. No joy, no indication of what's up. Right, shove unresolved external Listview into Google; no joy.

Long story short, opening up commctrl.h reveals that it needs a #define of _WIN32_WINNT to pick these up. THANKS A LOT GUYS. Pop this into the MSDN search and there it is, under the heading of "Using the Windows Headers". But - unless you knew to look for these - there is NO WAY ON EARTH that you are going to find it. What's wrong with adding one teensy weensy line to the documentation for ListView_InsertGroup etc? Just one line, "you need to define _WIN32_WINNT to 0x501 or higher to use these"?

This is an exact repeat of the experience I had learning Direct3D; all the info was there, but in isolation. There was no feel for how things fit together. I know that Win32 is semi-officially "dead", and that MS would like app developers to switch to .NET, but let me ask them a few questions. What if one has a legacy codebase consisting of perfectly good (and debugged) code that one just wants to spruce up a little? Where are the next generation of low level native programmers going to come from? How many hours of programmers time have been wasted so that MS can save a few minutes?


Enough of that. I'm only getting to pick up the code again now, so - assuming all goes well with the bugfixing - it'll be late this week or early next week at the soonest.

0 comments: