Creating a list or array of IHTMLElementCollection ptrs
-
Hi, I need to store in an array or list, a dynamic number of IHTMLElementCollectionPtr's The array/list needs to be dynamic as each collection represents a set of images from a web page. The number of open internet explorer's can vary, and the user should at any time be able to open up a new IE browser, and refresh my applicaton to represent the images from each browser. I can't use new() on the pointer, because it is the address of the pointer that is supplied to the appropriate IE functions, i just need to create an array of raw pointers. Is there something in the stl which can help me ? I cannot implement a copy constructor for IHTMLElementCollectionPtr's, so that rules out 'list' etc, and I can't use MFC's collection objects as it is not derived from CObject. Any ideas please ? I've tried writing my own class to store these but i'd rather go with something tried and trusted. Jase
-
Hi, I need to store in an array or list, a dynamic number of IHTMLElementCollectionPtr's The array/list needs to be dynamic as each collection represents a set of images from a web page. The number of open internet explorer's can vary, and the user should at any time be able to open up a new IE browser, and refresh my applicaton to represent the images from each browser. I can't use new() on the pointer, because it is the address of the pointer that is supplied to the appropriate IE functions, i just need to create an array of raw pointers. Is there something in the stl which can help me ? I cannot implement a copy constructor for IHTMLElementCollectionPtr's, so that rules out 'list' etc, and I can't use MFC's collection objects as it is not derived from CObject. Any ideas please ? I've tried writing my own class to store these but i'd rather go with something tried and trusted. Jase
Jase Jennings wrote: I cannot implement a copy constructor for IHTMLElementCollectionPtr's This requirement seems to rule out ANY STL container, as all of these rely on copying. But
IHTMLElementCollectionPtr
is a smart-pointer to something COM-ish IIRC? So it most probably already has a copy-constructor and reference counting? If not, you can use the BOOSTlibrary and itsshared_ptr
-template, which can make any pointer into a reference-counting smart-pointer that is fully STL-capable.
My opinions may have changed, but not the fact that I am right.