<!– Download Links –>
<!– Article image –>
<!– Main HTML starts here –>
This program was written to make implementing a collection in ATL a snap. The
first time I built a collection class in ATL it took me several hours. Than I
found a very useful class written by Chris Brooks that allowed me to do it in 20
minutes. All this class needed was an easy way to generate the right parameters
which is what this program does. Now you can generate a working collection class
in half a minute.
This program also makes use of a .ocx that I wrote around a class by Michael
CDirTreeCtrl). In order for it to work you need to click on Install.bat
in this folder (in LookHereFirst/).
How to make a collection class the easy way
- create an ATL dll project.
- add 2 classes (e.g Data and DataGroup)
- compile the project.
Now run CollectionWizard. First browse to your project’s folder. Then click
step 1. This will read the *_i.c file in your project and fill up the combo’s.
It will also read Collectionhelper.h included at the end of the .exe into
your project’s folder.
Make sure the right items are selected in the combo’s and that the collection
classname is spelled correctly.
Then hit step 2. All you need to do now is copy and paste the results in your
.idl file and the collection class headerfile (‘DataGroup.h’).
Your collection is now fully implemented so you can concentrate on your
‘Data’ class instead!
The release version in LookHereFirst/ works “as is” but if for some
reason you need to rebuild it it’s a little trickier.
You will need to zip “collectionhelper.h” to the end of your .exe.
How to add collectionhelper.h to the end of your executable
Make a directory /cpp at the root of your drive and place
Then, build the project, run the release version and here,while holding down
Ctrl+Shift click the lower copy button. This will create a folder temp2847 in
your release folder with in it your new .exe that will take the place of the exe
you just ran. (Simply cut and paste it to where you need it).
This version will have the file appended to the end which is what is needed
for this program to work.