|
/********************************************************************
Created: 31/3/2004, 21:49
File name: D:\Projects\Exile\Exile\Registry.h
File path: D:\Projects\Exile\Exile
File base: Registry
File ext: h
Author: Gogolev Anton
*********************************************************************/
#ifndef _REGISTRY_H
#define _REGISTRY_H
#define HKCU HKEY_CURRENT_USER
#define HKLM HKEY_LOCAL_MACHINE
#define HKCR HKEY_CLASSES_ROOT
#define HKU HKEY_USERS
class CRegistry
{
public:
CRegistry();
~CRegistry();
protected:
HKEY m_hRootKey;
BOOL m_bDelayedWrite;
CString m_strCurrentPath;
int m_nLastError;
public:
inline int GetLastClassError() { return m_nLastError; }
inline BOOL IsPathValid() { return (m_strCurrentPath.GetLength() > 0); }
inline CString GetCurrentPath() { return m_strCurrentPath; }
inline HKEY GetRootKey() { return m_hRootKey; }
inline void SetDelayedWrite(BOOL bDelayed = FALSE) { m_bDelayedWrite = bDelayed; }
inline BOOL GetDelayedWrite() { return m_bDelayedWrite; }
BOOL ClearKey();
BOOL SetRootKey(HKEY hRootKey);
BOOL CreateKey(CString strKey);
BOOL DeleteKey(CString strKey);
BOOL DeleteValue(CString strKey);
BOOL SetKey(CString strKeyName, BOOL bCanCreate = TRUE);
BOOL KeyExists(CString strKeyName, HKEY hRoot = NULL);
double ReadDouble(CString strKeyName, double fDefault = 0.0);
CString ReadString(CString strKeyName, CString strDefault = CString(""));
int ReadInt(CString strKeyName, int nDefault = 0);
BOOL ReadBool(CString strKeyName, BOOL bDefault = FALSE);
DWORD ReadDword(CString strKeyName, DWORD dwDefault = 0);
COleDateTime ReadDateTime(CString strKeyName, COleDateTime &dtDefault = COleDateTime::GetCurrentTime());
BOOL WriteDouble(CString strKeyName, double fValue = 0.0);
BOOL WriteString(CString strKeyName, CString strValue = CString(""));
BOOL WriteInt(CString strKeyName, int nValue = 0);
BOOL WriteBool(CString strKeyName, BOOL bValue = FALSE);
BOOL WriteDword(CString strKeyName, DWORD dwValue = 0);
BOOL WriteDateTime(CString strKeyName, COleDateTime &dtValue = COleDateTime::GetCurrentTime());
};
#endif _REGISTRY_H
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here