]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/regkey.tex
Script updates
[wxWidgets.git] / docs / latex / wx / regkey.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: regkey.tex
3 %% Purpose: wxRegKey docs
4 %% Author: Ryan Norton <wxprojects@comcast.net>, C.C.Chakkaradeep
5 %% Modified by:
6 %% Created: 2/5/2005
7 %% RCS-ID: $Id$
8 %% Copyright: (c) Ryan Norton (C.C.Chakkaradeep?)
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{\class{wxRegKey}}\label{wxregkey}
13
14 wxRegKey is a class representing the Windows registry. One can create, query and delete registry keys using this class.
15
16 The Windows registry is easy to understand. There are five registry keys, namely:
17
18 \begin{enumerate}\itemsep=0pt
19 \item HKEY\_CLASSES\_ROOT (HKCR)
20 \item HKEY\_CURRENT\_USER (HKCU)
21 \item HKEY\_LOCAL\_MACHINE (HKLM)
22 \item HKEY\_CURRENT\_CONFIG (HKCC)
23 \item HKEY\_USERS (HKU)
24 \end{enumerate}
25
26 After creating a key, it can hold a value. The values can be:
27
28 \begin{enumerate}\itemsep=0pt
29 \item String Value
30 \item Binary Value
31 \item DWORD Value
32 \item Multi String Value
33 \item Expandable String Value
34 \end{enumerate}
35
36 \wxheading{Derived from}
37
38 None
39
40 \wxheading{Include files}
41
42 <wx/config.h>
43
44 \wxheading{Example}
45
46 \begin{verbatim}
47 wxRegKey *pRegKey = new wxRegKey("HKEY_LOCAL_MACHINE\\Software\\MyKey");
48
49 //will create the Key if it does not exist
50 if( !pRegKey->Exists() )
51 pRegKey->Create();
52
53 //will create a new value MYVALUE and set it to 12
54 pRegKey->SetValue("MYVALUE",12);
55
56 //Query for the Value and Retrieve it
57 long lMyVal;
58 wxString strTemp;
59 pRegKey->QueryValue("MYVALUE",&lMyVal);
60 strTemp.Printf("%d",lMyVal);
61 wxMessageBox(strTemp,"Registry Value",0,this);
62
63 //Retrive the number of SubKeys and enumerate them
64 size_t nSubKeys;
65 pRegKey->GetKeyInfo(&nSubKeys,NULL,NULL,NULL);
66
67 pRegKey->GetFirstKey(strTemp,1);
68 for(int i=0;i<nSubKeys;i++)
69 {
70 wxMessageBox(strTemp,"SubKey Name",0,this);
71 pRegKey->GetNextKey(strTemp,1);
72 }
73 \end{verbatim}
74
75 \latexignore{\rtfignore{\wxheading{Members}}}
76
77 \membersection{wxRegKey::wxRegKey}\label{wxregkeyctor}
78
79 \func{}{wxRegKey}{\void}
80
81 The Constructor to set to HKCR
82
83 \func{}{wxRegKey}{\param{const wxString\&}{ strKey}}
84
85 The constructor to set the full name of the key.
86
87 \func{}{wxRegKey}{\param{const wxRegKey\&}{ keyParent}, \param{const wxString\&}{ strKey}}
88
89 The constructor to set the full name of the key under a previously created parent.
90
91 \membersection{wxRegKey::Close}\label{wxregkeyclose}
92
93 \func{void}{Close}{\void}
94
95 Closes the key.
96
97 \membersection{wxRegKey::Create}\label{wxregkeycreate}
98
99 \func{bool}{Create}{\param{bool }{bOkIfExists = true}}
100
101 Creates the key. Will fail if the key already exists and {\it bOkIfExists} is false.
102
103 \membersection{wxRegKey::DeleteSelf}\label{wxregkeydeleteself}
104
105 \func{void}{DeleteSelf}{\void}
106
107 Deletes this key and all of its subkeys and values recursively.
108
109 \membersection{wxRegKey::DeleteKey}\label{wxregkeydeletekey}
110
111 \func{void}{DeleteKey}{\param{const wxChar *}{szKey}}
112
113 Deletes the subkey with all of its subkeys/values recursively.
114
115 \membersection{wxRegKey::DeleteValue}\label{wxregkeydeletevalue}
116
117 \func{void}{DeleteValue}{\param{const wxChar *}{szKey}}
118
119 Deletes the named value.
120
121 \membersection{wxRegKey::Exists}\label{wxregkeyexists}
122
123 \constfunc{static bool}{Exists}{\void}
124
125 Returns true if the key exists.
126
127 \membersection{wxRegKey::GetName}\label{wxregkeygetname}
128
129 \constfunc{wxString}{GetName}{\param{bool }{bShortPrefix = true}}
130
131 Gets the name of the registry key.
132
133 \membersection{wxRegKey::GetFirstKey}\label{wxregkeygetfirstkey}
134
135 \func{bool}{GetKeyValue}{\param{wxString\&}{ strKeyName}, \param{long\&}{ lIndex}}
136
137 Gets the first key.
138
139 \membersection{wxRegKey::GetFirstValue}\label{wxregkeygetfirstvalue}
140
141 \func{bool}{GetFirstValue}{\param{wxString\&}{ strValueName}, \param{long\&}{ lIndex}}
142
143 Gets the first value of this key.
144
145 \membersection{wxRegKey::GetKeyInfo}\label{wxregkeygetkeyinfo}
146
147 \constfunc{bool}{Exists}{\param{size\_t *}{pnSubKeys}, \param{size\_t *}{pnValues}, \param{size\_t *}{pnMaxValueLen}}
148
149 Gets information about the key.
150
151 \wxheading{Parameters}
152
153 \docparam{pnSubKeys}{The number of subkeys.}
154
155 \docparam{pnMaxKeyLen}{The maximum length of the subkey name.}
156
157 \docparam{pnValues}{The number of values.}
158
159 \membersection{wxRegKey::GetNextKey}\label{wxregkeygetnextkey}
160
161 \constfunc{bool}{GetNextKey}{\param{wxString\&}{ strKeyName}, \param{long\&}{ lIndex}}
162
163 Gets the next key.
164
165 \membersection{wxRegKey::GetNextValue}\label{wxregkeygetnextvalue}
166
167 \constfunc{bool}{GetNextValue}{\param{wxString\&}{ strValueName}, \param{long\&}{ lIndex}}
168
169 Gets the next key value for this key.
170
171 \membersection{wxRegKey::HasValue}\label{wxregkeyhasvalue}
172
173 \constfunc{bool}{HasValue}{\param{const wxChar *}{szValue}}
174
175 Returns true if the value exists.
176
177 \membersection{wxRegKey::HasValues}\label{wxregkeyhasvalues}
178
179 \constfunc{bool}{HasValues}{\void}
180
181 Returns true if any values exist.
182
183 \membersection{wxRegKey::HasSubKey}\label{wxregkeyhassubkey}
184
185 \constfunc{bool}{HasSubKey}{\param{const wxChar *}{szKey}}
186
187 Returns true if given subkey exists.
188
189 \membersection{wxRegKey::HasSubKeys}\label{wxregkeyhassubkeys}
190
191 \constfunc{bool}{HasSubKeys}{\void}
192
193 Returns true if any subkeys exist.
194
195 \membersection{wxRegKey::IsEmpty}\label{wxregkeyisempty}
196
197 \constfunc{bool}{IsEmpty}{\void}
198
199 Returns true if this key is empty, nothing under this key.
200
201 \membersection{wxRegKey::IsOpened}\label{wxregkeyisopened}
202
203 \constfunc{bool}{IsOpened}{\void}
204
205 Returns true if the key is opened.
206
207 \membersection{wxRegKey::Open}\label{wxregkeyopen}
208
209 \func{bool}{Open}{\void}
210
211 Explicitly opens the key to be opened.
212
213 \membersection{wxRegKey::QueryValue}\label{wxregkeyqueryvalue}
214
215 \constfunc{bool}{QueryValue}{\param{const wxChar *}{szValue}, \param{wxString\&}{ strValue}}
216
217 Retrieves the string value.
218
219 \constfunc{bool}{QueryValue}{\param{const wxChar *}{szValue}, \param{long *}{plValue}}
220
221 Retrieves the numeric value.
222
223 \membersection{wxRegKey::Rename}\label{wxregkeyrename}
224
225 \func{bool}{Rename}{\param{const wxChar *}{ szNewName}}
226
227 Renames the key.
228
229 \membersection{wxRegKey::RenameValue}\label{wxregkeyrenamevalue}
230
231 \func{bool}{RenameValue}{\param{const wxChar *}{szValueOld}, \param{const wxChar *}{szValueNew}}
232
233 Renames a value.
234
235 \membersection{wxRegKey::SetValue}\label{wxregkeysetvalue}
236
237 \func{bool}{SetValue}{\param{const wxChar *}{szValue}, \param{long}{ lValue}}
238
239 Sets the numeric value.
240