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