]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/regkey.tex
Updated wxSlider docs now that wxSL_INVERSE is available on MSW, GTK and Mac.
[wxWidgets.git] / docs / latex / wx / regkey.tex
CommitLineData
38b9e339
RN
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
14wxRegKey is a class representing the Windows Registry.
15
16One can Create, Query and Delete Registry Keys using this class.
17
18Windows Registry is easy to understand. There are 5 Registry Keys namely,
19
5e091b2b
WS
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}
38b9e339
RN
27
28After creating a Key , it can hold a Value. The Values can be ,
29
5e091b2b
WS
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
40None
41
42\wxheading{Include files}
43
44<wx/config.h>
45
46\wxheading{Example}
38b9e339 47
38b9e339
RN
48\begin{verbatim}
49wxRegKey *pRegKey = new wxRegKey("HKEY_LOCAL_MACHINE\\Software\\MyKey");
50
51//will create the Key if it does not exist
52if( !pRegKey->Exists() )
53 pRegKey->Create();
54
55//will create a new value MYVALUE and set it to 12
56pRegKey->SetValue("MYVALUE",12);
57
58//Query for the Value and Retrieve it
59long lMyVal;
60wxString strTemp;
61pRegKey->QueryValue("MYVALUE",&lMyVal);
62strTemp.Printf("%d",lMyVal);
63wxMessageBox(strTemp,"Registry Value",0,this);
64
65//Retrive the number of SubKeys and enumerate them
66size_t nSubKeys;
67pRegKey->GetKeyInfo(&nSubKeys,NULL,NULL,NULL);
68
69pRegKey->GetFirstKey(strTemp,1);
70for(int i=0;i<nSubKeys;i++)
71{
72 wxMessageBox(strTemp,"SubKey Name",0,this);
73 pRegKey->GetNextKey(strTemp,1);
74}
75\end{verbatim}
76
5e091b2b 77\latexignore{\rtfignore{\wxheading{Members}}}
38b9e339 78
5e091b2b 79\membersection{wxRegKey::wxRegKey}\label{wxregkeyctor}
38b9e339
RN
80
81\func{}{wxRegKey}{\void}
82
83The Constructor to set to HKCR
84
85\func{}{wxRegKey}{\param{const wxString\&}{strKey}}
86
87The constructor to set the full name of the key.
88
89\func{}{wxRegKey}{\param{const wxRegKey\&}{keyParent}\param{const wxString\&}{strKey}}
90
91The 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
98Close the Key
99
100
101\membersection{wxRegKey::Create}\label{wxregkeycreate}
102
5e091b2b 103\func{bool}{Create}{\param{bool }{bOkIfExists = true}}
38b9e339
RN
104
105Create 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
112Deletes 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
119Deletes 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
126Deletes the named value
127
128
129\membersection{wxRegKey::Exists}\label{wxregkeyexists}
130
131\constfunc{static bool}{Exists}{\void}
132
5e091b2b 133Return true if the Key Exists
38b9e339
RN
134
135
136\membersection{wxRegKey::GetName}\label{wxregkeygetname}
137
5e091b2b 138\constfunc{wxString}{GetName}{\param{bool }{bShortPrefix = true}}
38b9e339
RN
139
140Get 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
147Get the First Key
148
149
150\membersection{wxRegKey::GetFirstValue}\label{wxregkeygetfirstvalue}
151
152\func{bool}{GetFirstValue}{\param{wxString\&}{strValueName}, \param{long\&}{lIndex}}
153
154Get 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
161Get 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
172Get 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
179Get 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
186Return true if the value exists
187
188
189\membersection{wxRegKey::HasValues}\label{wxregkeyhasvalues}
190
191\constfunc{bool}{HasValues}{\void}
192
193Return true if any values exist
194
195
196\membersection{wxRegKey::HasSubKey}\label{wxregkeyhassubkey}
197
198\constfunc{bool}{HasSubKey}{\param{const wxChar *}{szKey}}
199
200Return true if given subkey exists
201
202
203\membersection{wxRegKey::HasSubKeys}\label{wxregkeyhassubkeys}
204
205\constfunc{bool}{HasSubKeys}{\void}
206
207Return true if any subkeys exist
208
209
210\membersection{wxRegKey::IsEmpty}\label{wxregkeyisempty}
211
212\constfunc{bool}{IsEmpty}{\void}
213
214Return 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
221Return true if the Key is Opened
222
223
224\membersection{wxRegKey::Open}\label{wxregkeyopen}
225
226\func{bool}{Open}{\void}
227
228Explicitly 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
235Retrieve the String Value
236
237\constfunc{bool}{QueryValue}{\param{const wxChar *}{szValue}, \param{long *}{plValue}}
238
239Retrive the Numeric Value
240
241
242\membersection{wxRegKey::Rename}\label{wxregkeyrename}
243
244\func{bool}{Rename}{\param{const wxChar *}{ szNewName}}
245
246Rename the Key
247
248
249\membersection{wxRegKey::RenameValue}\label{wxregkeyrenamevalue}
250
251\func{bool}{RenameValue}{\param{const wxChar *}{szValueOld}, \param{const wxChar *}{szValueNew}}
252
253Rename 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
260Set the Numeric Value