root/trunk/Registry.h

Revision 5, 2.2 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 #ifndef __REGISTRY_H__
2 #define __REGISTRY_H__
3
4 class CRegistry
5 {
6 public:
7     CRegistry();
8     ~CRegistry();
9
10 int m_nLastError;
11
12 // CRegistry properties
13 protected:
14     HKEY m_hRootKey;
15     BOOL m_bLazyWrite;
16     CString m_strCurrentPath;
17
18 public:
19     inline BOOL PathIsValid() {
20         return (m_strCurrentPath.GetLength() > 0); }
21     inline CString GetCurrentPath() {
22         return m_strCurrentPath; }
23     inline HKEY GetRootKey() {
24         return m_hRootKey; }
25
26
27 //CRegistry methods
28 public:
29     BOOL ClearKey();
30     BOOL SetRootKey(HKEY hRootKey);
31     BOOL CreateKey(CString strKey);
32     BOOL DeleteKey(CString strKey);
33     BOOL DeleteValue(CString strName);
34     int GetDataSize(CString strValueName);
35     DWORD GetDataType(CString strValueName);
36     int GetSubKeyCount();
37     int GetValueCount();
38     BOOL KeyExists(CString strKey, HKEY hRootKey = NULL);
39     BOOL SetKey(CString strKey, BOOL bCanCreate);
40     BOOL ValueExists(CString strName);
41     void RenameValue(CString strOldName, CString strNewName);
42
43     // data reading functions
44     COleDateTime ReadDateTime(CString strName, COleDateTime dtDefault);
45     double ReadFloat(CString strName, double fDefault);
46     CString ReadString(CString strName, CString strDefault);
47     int ReadInt(CString strName, int nDefault);
48     BOOL ReadBool(CString strName, BOOL bDefault);
49     COLORREF ReadColor(CString strName, COLORREF rgbDefault);
50     BOOL ReadFont(CString strName, CFont* pFont);
51     BOOL ReadPoint(CString strName, CPoint* pPoint);
52     BOOL ReadSize(CString strName, CSize* pSize);
53     BOOL ReadRect(CString strName, CRect* pRect);
54     DWORD ReadDword(CString strName, DWORD dwDefault);
55
56     // data writing functions
57     BOOL WriteBool(CString strName, BOOL bValue);
58     BOOL WriteDateTime(CString strName, COleDateTime dtValue);
59     BOOL WriteString(CString strName, CString strValue);
60     BOOL WriteFloat(CString strName, double fValue);
61     BOOL WriteInt(CString strName, int nValue);
62     BOOL WriteColor(CString strName, COLORREF rgbValue);
63     BOOL WriteFont(CString strName, CFont* pFont);
64     BOOL WritePoint(CString strName, CPoint* pPoint);
65     BOOL WriteSize(CString strName, CSize* pSize);
66     BOOL WriteRect(CString strName, CRect* pRect);
67     BOOL WriteDword(CString strName, DWORD dwValue);
68
69 };// end of CRegistry class definition
70
71
72 #endif
Note: See TracBrowser for help on using the browser.