Windows C++ Library
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
WCL::RegKey Class Reference

The class used to read and write from the loca Registry. More...

#include <RegKey.hpp>

List of all members.

Public Member Functions

 RegKey ()
 Default constructor.
 ~RegKey ()
 Destructor.
HKEY Handle () const
 Get the underlying handle.
bool IsOpen () const
 Query if the key is open.
void Create (HKEY hParentKey, const tchar *pszSubKey)
 Create a key and open it for writing.
void Open (HKEY hParentKey, const tchar *pszSubKey, REGSAM dwAccess)
 Open the key for reading or writing.
void Close ()
 Close the key.
CString ReadDefaultValue () const
 Read the default value for the key.
CString ReadStringValue (const tchar *pszName, const tchar *pszDefault) const
 Read a named string value under the key.
void WriteDefaultValue (const tchar *pszValue)
 Write the default value for the key.
void WriteStringValue (const tchar *pszName, const tchar *pszValue)
 Write a named string value under the key.

Static Public Member Functions

static bool Exists (HKEY hParentKey, const tchar *pszSubKey)
 Query if the key exists.
static void CreateSubKey (HKEY hParentKey, const tchar *pszSubKey)
 Create a sub key.
static bool Delete (HKEY hParentKey, const tchar *pszSubKey)
 Delete the key.
static bool DeleteTree (HKEY hParentKey, const tchar *pszSubKey)
 Delete the entire sub-tree.
static CString ReadKeyDefaultValue (HKEY hParentKey, const tchar *pszSubKey)
 Read the default value for a key.
static void WriteKeyDefaultValue (HKEY hParentKey, const tchar *pszSubKey, const tchar *pszValue)
 Write the default value for a key.
static CString ReadKeyStringValue (HKEY hParentKey, const tchar *pszSubKey, const tchar *pszName, const tchar *pszDefault)
 Read a named string value under a key.
static void WriteKeyStringValue (HKEY hParentKey, const tchar *pszSubKey, const tchar *pszName, const tchar *pszValue)
 Write a named string value under a key.
static const tchar * KeyTypeToStr (DWORD dwType)
 Convert a registry key type to the symbolic name.

Private Member Functions

 RegKey (const RegKey &)
RegKeyoperator= (const RegKey &)

Private Attributes

HKEY m_hKey
 The handle to the key.

Detailed Description

The class used to read and write from the loca Registry.


Constructor & Destructor Documentation

Default constructor.

Destructor.

WCL::RegKey::RegKey ( const RegKey ) [private]

Member Function Documentation

HKEY WCL::RegKey::Handle ( ) const [inline]

Get the underlying handle.

bool WCL::RegKey::IsOpen ( ) const [inline]

Query if the key is open.

void WCL::RegKey::Create ( HKEY  hParentKey,
const tchar *  pszSubKey 
)

Create a key and open it for writing.

void WCL::RegKey::Open ( HKEY  hParentKey,
const tchar *  pszSubKey,
REGSAM  dwAccess 
)

Open the key for reading or writing.

Close the key.

Read the default value for the key.

CString WCL::RegKey::ReadStringValue ( const tchar *  pszName,
const tchar *  pszDefault 
) const

Read a named string value under the key.

void WCL::RegKey::WriteDefaultValue ( const tchar *  pszValue)

Write the default value for the key.

void WCL::RegKey::WriteStringValue ( const tchar *  pszName,
const tchar *  pszValue 
)

Write a named string value under the key.

bool WCL::RegKey::Exists ( HKEY  hParentKey,
const tchar *  pszSubKey 
) [static]

Query if the key exists.

void WCL::RegKey::CreateSubKey ( HKEY  hParentKey,
const tchar *  pszSubKey 
) [static]

Create a sub key.

bool WCL::RegKey::Delete ( HKEY  hParentKey,
const tchar *  pszSubKey 
) [static]

Delete the key.

This only deletes the key and any named values, it does not recursively delete any subkeys. If the method fails the error code can be retrieved with GetLastError().

bool WCL::RegKey::DeleteTree ( HKEY  hParentKey,
const tchar *  pszSubKey 
) [static]

Delete the entire sub-tree.

If the method fails the error code can be retrieved with GetLastError().

CString WCL::RegKey::ReadKeyDefaultValue ( HKEY  hParentKey,
const tchar *  pszSubKey 
) [static]

Read the default value for a key.

void WCL::RegKey::WriteKeyDefaultValue ( HKEY  hParentKey,
const tchar *  pszSubKey,
const tchar *  pszValue 
) [static]

Write the default value for a key.

The key is created if it doesn't exist.

CString WCL::RegKey::ReadKeyStringValue ( HKEY  hParentKey,
const tchar *  pszSubKey,
const tchar *  pszName,
const tchar *  pszDefault 
) [static]

Read a named string value under a key.

void WCL::RegKey::WriteKeyStringValue ( HKEY  hParentKey,
const tchar *  pszSubKey,
const tchar *  pszName,
const tchar *  pszValue 
) [static]

Write a named string value under a key.

The key is created if it doesn't exist.

const tchar * WCL::RegKey::KeyTypeToStr ( DWORD  dwType) [static]

Convert a registry key type to the symbolic name.

RegKey& WCL::RegKey::operator= ( const RegKey ) [private]

Member Data Documentation

HKEY WCL::RegKey::m_hKey [private]

The handle to the key.


The documentation for this class was generated from the following files: