Without meaning to dampen your enthusiasm, this is both a very basic question and a very bad idea.
With this approach, you might as well sprint the process id into a string and atoi it out in KM using the REG_SZ values you already know how to use. The extra overhead will be the least of your issues. At the very least, remember that process id is ephemeral and can be recycled at any time. Also remember that there is no real way to synchronize access or be notified when changes are made in any kind of efficient way