Q: How can I access the registry?

A: The ATL provides the class 'CRegKey()' containing the following members which can be used in MFC without any problems:

Code:
// Methods
CRegKey()
void Attach(HKEY hKey)
LONG Close()
LONG Create(HKEY                  hKeyParent,
            LPCTSTR               lpszKeyName,
            LPTSTR                lpszClass = REG_NONE,
            DWORD                 dwOptions = REG_OPTION_NON_VOLATILE,
            REGSAM                samDesired = KEY_ALL_ACCESS,
            LPSECURITY_ATTRIBUTES lpSecAttr = NULL,
            LPDWORD               lpdwDisposition = NULL)
LONG DeleteSubKey(LPCTSTR lpszSubKey)
LONG DeleteValue(LPCTSTR lpszValue)
HKEY Detach()
LONG Open(HKEY    hKeyParent,
          LPCTSTR lpszKeyName,
          REGSAM  samDesired = KEY_ALL_ACCESS)
LONG QueryValue(DWORD& dwValue, LPCTSTR lpszValueName)
LONG QueryValue(LPTSTR szValue, LPCTSTR lpszValueName, DWORD* pdwCount)
LONG RecurseDeleteKey(LPCTSTR lpszKey)
LONG SetKeyValue(LPCTSTR lpszKeyName,
                 LPCTSTR lpszValue,
                 LPCTSTR lpszValueName = NULL)
LONG SetValue(DWORD dwValue, LPCTSTR lpszValueName)
LONG SetValue(LPCTSTR lpszValue, LPCTSTR lpszValueName = NULL)
LONG SetValue(HKEY    hKeyParent,
              LPCTSTR lpszKeyName,
              LPCTSTR lpszValue,
              LPCTSTR lpszValueName = NULL)

// Operators
operator HKEY() const