for (long i = 0; parameters.GetCount(); i++) {

What could be wrong with that??

Aaaaaaaaaaaaaaaaaargh.  Curse you C++!!!!!!!!!!!!!!!!  Can't that at least be a warning?