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