i want to know how can i create a counter build inside the registry....

i know part of the code : the part in which i create a certain key in the registry ....
but i dont know how to read the value of the key and how to
set it's value..

please help...