Click here to Skip to main content
15,879,535 members
Articles / Programming Languages / C++
Tip/Trick

[VS2017] ListView Demonstration

Rate me:
Please Sign up or sign in to vote.
4.92/5 (4 votes)
13 Feb 2018CPOL2 min read 10.9K   392   7   3
Code attached to a 2003 article updated for Visual Studio 2017.

Introduction

From the original 2003 article:

This article is for those who did not find, any useful code examples and information regarding ListControl (ListView). For me, it was really hard to get a working code for Win32 API, since I don't code in MFC. The only help I was able to get was win32.hlp which contains every API by Microsoft. Note that it did not have any examples in it. Also searching through forums can be helpful, but it is slow and sometimes you really wanna get some stuff going fast and clear. I decided to write this article for the coders who don't know any MFC (class) or just starting with ListControl via APIs. First, I must say that all examples I've seen so far lacked information for non-MFC coders!. If you can't code or can't understand MFC, and are using the API, then this little article is for you.

Attempting to build the code from the original article resulted in many errors, so the code from this tip/trick is aimed at getting the learner straight into the demonstration without delay.

Background

Listviews are a useful piece of architecture today, just as much as they were fifteen years ago, and even back in the nineties, but besides the MSDN, there are very few instructive articles for the WinAPI approach - although this SO contribution might add to the picture as well.

Using the Code

Extract the attached source code to the current Visual Studio projects directory, open the sln file, and build the project. The project should also build without issue in VS2015. Please show appreciation of the Listview demonstration to Benji on his article page.

Points of Interest

The attachment to this tip/trick is based on the excellent 2003 article by Benji. The original article contains code and project settings which have been superseded by newer code and project settings in more recent versions of Visual Studio and C++. The debug build port is kept as close to the original as possible, and the ported executable performs as well as the original.

In building the project, VS 2017 loaded on double clicking listview.dsp in explorer, and the subsequent conversion to VS2017 format was seamless.

Of interest was an issue regarding the referenced afxres.h in the resource file listview.rsrc.rc. viz the logged APStudio Generated from the TEXTINCLUDE 2 resource message. This would pose no problem for VS2017 subscribers if they had already opted for the VS 1.25 Gb MFC libraries inclusion, but without MFC libraries the reference was manually removed with no deleterious effects in the attached build.

History

  • Version 1.0

Future versions will include 64 bit & Unicode samples.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionToo late Pin
Merlin8714-Feb-18 3:06
Merlin8714-Feb-18 3:06 
QuestionCode Link is broken Pin
jeffie10013-Feb-18 16:49
jeffie10013-Feb-18 16:49 
FYI - the link is broken
AnswerRe: Code Link is broken Pin
Laurie Stearn13-Feb-18 17:05
Laurie Stearn13-Feb-18 17:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.