]>
git.saurik.com Git - wxWidgets.git/blob - interface/msw/registry.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/registry.h
3 // Purpose: interface of wxRegKey
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @headerfile registry.h wx/msw/registry.h
13 wxRegKey is a class representing the Windows registry (it is only available
14 under Windows). One can create, query and delete registry keys using this
17 The Windows registry is easy to understand. There are five registry keys,
20 HKEY_CLASSES_ROOT (HKCR)
21 HKEY_CURRENT_USER (HKCU)
22 HKEY_LOCAL_MACHINE (HKLM)
23 HKEY_CURRENT_CONFIG (HKCC)
26 After creating a key, it can hold a value. The values can be:
32 Expandable String Value
44 The constructor to set the full name of the key under a previously created
48 wxRegKey(const wxString
& strKey
);
49 wxRegKey(const wxRegKey
& keyParent
, const wxString
& strKey
);
58 Creates the key. Will fail if the key already exists and @a bOkIfExists is
61 bool Create(bool bOkIfExists
= true);
64 Deletes the subkey with all of its subkeys/values recursively.
66 void DeleteKey(const wxChar
* szKey
);
69 Deletes this key and all of its subkeys and values recursively.
74 Deletes the named value.
76 void DeleteValue(const wxChar
* szKey
);
79 Returns @true if the key exists.
81 static bool Exists() const;
86 bool GetFirstKey(wxString
& strKeyName
, long& lIndex
);
89 Gets the first value of this key.
91 bool GetFirstValue(wxString
& strValueName
, long& lIndex
);
94 Gets information about the key.
97 The number of subkeys.
99 The maximum length of the subkey name.
101 The number of values.
103 The maximum length of a value.
105 bool GetKeyInfo(size_t* pnSubKeys
, size_t* pnValues
,
106 size_t* pnMaxValueLen
) const;
109 Gets the name of the registry key.
111 wxString
GetName(bool bShortPrefix
= true) const;
116 bool GetNextKey(wxString
& strKeyName
, long& lIndex
) const;
119 Gets the next key value for this key.
121 bool GetNextValue(wxString
& strValueName
, long& lIndex
) const;
124 Returns @true if given subkey exists.
126 bool HasSubKey(const wxChar
* szKey
) const;
129 Returns @true if any subkeys exist.
131 bool HasSubKeys() const;
134 Returns @true if the value exists.
136 bool HasValue(const wxChar
* szValue
) const;
139 Returns @true if any values exist.
141 bool HasValues() const;
144 Returns @true if this key is empty, nothing under this key.
146 bool IsEmpty() const;
149 Returns @true if the key is opened.
151 bool IsOpened() const;
154 Explicitly opens the key. This method also allows the key to be opened in
155 read-only mode by passing @c Read() instead of default
156 @c Write() parameter.
158 bool Open(AccessMode mode
= Write
);
162 Retrieves the numeric value.
164 bool QueryValue(const wxChar
* szValue
, wxString
& strValue
) const;
165 const bool QueryValue(const wxChar
* szValue
, long* plValue
) const;
171 bool Rename(const wxChar
* szNewName
);
176 bool RenameValue(const wxChar
* szValueOld
,
177 const wxChar
* szValueNew
);
181 Sets the given @a szValue which must be numeric, string or binary depending
182 on the overload used. If the value doesn't exist, it is created.
184 bool SetValue(const wxChar
* szValue
, long lValue
);
185 bool SetValue(const wxChar
* szValue
,
186 const wxString
& strValue
);
187 bool SetValue(const wxChar
* szValue
,
188 const wxMemoryBuffer
& buf
);