Fragment of class RegistryKey

Windows Registry

RegistryKey is a small utility class that hides the ugly details of accessing the Windows Registry. Almost everyone who has had to use the Registry must have written a similar wrapper, this is mine.

The key is opened by the class's constructor, and closed by the destructor when the object goes out of scope. The copy constructor takes 'ownership' of the key, in much the same way that auto_ptr's copy constructor passes ownership of its pointer. This means that RegistryKey objects cannot be safely stored in STL containers. I've made the default constructor private, so that the compiler will prevent anyone from trying.

Full code here.

Portfolio Multithreaded Programming Unix Daemon & Windows Service Windows Registry GNU Autoconf Documentation Web Design Java Python

2005, Alex Tingle. This work is licensed under a Creative Commons License.
Permission granted to copy but NOT TO MODIFY this document.