The following is a simple sample of using a CStringList. The first thing to do is to define a variable, as in:
CStringList StringList;
Then add entries, as in:
StringList.AddTail("A string");
Then iterating through the list could be as easy as in the following:
CString String; POSITION Position = StringList.GetHeadPosition(); while (Position) String = StringList.GetNext(Position);
Notice that since we are not storing pointers, there is not any clean-up necessary beyond the default destructor. When the CStringList is deleted, all strings are also deleted. This is different when a collection contains pointers, because then the data pointed to must be deleted prior to deleteing the collection.
See my Visual C++ Programmer Stuff page for more C++ stuff.