I think your question is: "how do I enum through a key and set values?"

Check this thread for details, How Do I locate and use the next available registry value