1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxRegKey docs
4 %% Author: Ryan Norton <wxprojects@comcast.net>, C.C.Chakkaradeep
8 %% Copyright: (c) Ryan Norton (C.C.Chakkaradeep?)
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxRegKey
}}\label{wxregkey
}
14 wxRegKey is a class representing the Windows Registry.
16 One can Create, Query and Delete Registry Keys using this class.
18 Windows Registry is easy to understand. There are
5 Registry Keys namely,
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)
}
29 After creating a Key , it can hold a Value. The Values can be ,
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
}
42 wxRegKey *pRegKey = new wxRegKey("HKEY_LOCAL_MACHINE\
\Software\
\MyKey");
44 //will create the Key if it does not exist
45 if( !pRegKey->Exists() )
48 //will create a new value MYVALUE and set it to
12
49 pRegKey->SetValue("MYVALUE",
12);
51 //Query for the Value and Retrieve it
54 pRegKey->QueryValue("MYVALUE",&lMyVal);
55 strTemp.Printf("
%d",lMyVal);
56 wxMessageBox(strTemp,"Registry Value",
0,this);
58 //Retrive the number of SubKeys and enumerate them
60 pRegKey->GetKeyInfo(&nSubKeys,NULL,NULL,NULL);
62 pRegKey->GetFirstKey(strTemp,
1);
63 for(int i=
0;i<nSubKeys;i++)
65 wxMessageBox(strTemp,"SubKey Name",
0,this);
66 pRegKey->GetNextKey(strTemp,
1);
70 \wxheading{Derived from
}
73 \wxheading{Include files
}
76 \membersection{wxRegKey::wxRegKey
}\label{wxregkeyregkey
}
78 \func{}{wxRegKey
}{\void}
80 The Constructor to set to HKCR
82 \func{}{wxRegKey
}{\param{const wxString\&
}{strKey
}}
84 The constructor to set the full name of the key.
86 \func{}{wxRegKey
}{\param{const wxRegKey\&
}{keyParent
}\param{const wxString\&
}{strKey
}}
88 The constructor to set the full name of the key under previously created keyParent.
91 \membersection{wxRegKey::Close
}\label{wxregkeyclose
}
93 \func{void
}{Close
}{\void}
98 \membersection{wxRegKey::Create
}\label{wxregkeycreate
}
100 \func{bool
}{Create
}{\param{bool
}{bOkIfExists = TRUE
}}
102 Create the Key,Will fail if the Key already exists and !bOkIfExists
105 \membersection{wxRegKey::DeleteSelf
}\label{wxregkeydeleteself
}
107 \func{void
}{DeleteSelf
}{\void}
109 Deletes this Key and all of it's subkeys/values recursively
112 \membersection{wxRegKey::DeleteKey
}\label{wxregkeydeletekey
}
114 \func{void
}{DeleteKey
}{\param{const wxChar *
}{szKey
}}
116 Deletes the subkey with all of it's subkeys/values recursively
119 \membersection{wxRegKey::DeleteValue
}\label{wxregkeydeletevalue
}
121 \func{void
}{DeleteValue
}{\param{const wxChar *
}{szKey
}}
123 Deletes the named value
126 \membersection{wxRegKey::Exists
}\label{wxregkeyexists
}
128 \constfunc{static bool
}{Exists
}{\void}
130 Return True if the Key Exists
133 \membersection{wxRegKey::GetName
}\label{wxregkeygetname
}
135 \constfunc{wxString
}{GetName
}{\param{bool
}{bShortPrefix = TRUE
}}
137 Get the name of the Registry Key
140 \membersection{wxRegKey::GetFirstKey
}\label{wxregkeygetfirstkey
}
142 \func{bool
}{GetKeyValue
}{\param{wxString\&
}{strKeyName
},
\param{long\&
}{lIndex
}}
147 \membersection{wxRegKey::GetFirstValue
}\label{wxregkeygetfirstvalue
}
149 \func{bool
}{GetFirstValue
}{\param{wxString\&
}{strValueName
},
\param{long\&
}{lIndex
}}
151 Get the First Value of this Key
154 \membersection{wxRegKey::GetKeyInfo
}\label{wxregkeygetkeyinfo
}
156 \constfunc{bool
}{Exists
}{\param{size
\_t *
}{pnSubKeys
},
\param{size
\_t *
}{pnValues
},
\param{size
\_t *
}{pnMaxValueLen
}}
158 Get the info about the key
160 \docparam{pnSubKeys
}{Number of SubKeys
}
161 \docparam{pnMaxKeyLen
}{Max length of SubKey name
}
162 \docparam{pnValues
}{Number of Values
}
165 \membersection{wxRegKey::GetNextKey
}\label{wxregkeygetnextkey
}
167 \constfunc{bool
}{GetNextKey
}{\param{wxString\&
}{strKeyName
},
\param{long\&
}{lIndex
}}
169 Get the next Key of this Key
172 \membersection{wxRegKey::GetNextValue
}\label{wxregkeygetnextvalue
}
174 \constfunc{bool
}{GetNextValue
}{\param{wxString\&
}{strValueName
},
\param{long\&
}{lIndex
}}
176 Get the Next Key Value of this Key
179 \membersection{wxRegKey::HasValue
}\label{wxregkeyhasvalue
}
181 \constfunc{bool
}{HasValue
}{\param{const wxChar *
}{szValue
}}
183 Return true if the value exists
186 \membersection{wxRegKey::HasValues
}\label{wxregkeyhasvalues
}
188 \constfunc{bool
}{HasValues
}{\void}
190 Return true if any values exist
193 \membersection{wxRegKey::HasSubKey
}\label{wxregkeyhassubkey
}
195 \constfunc{bool
}{HasSubKey
}{\param{const wxChar *
}{szKey
}}
197 Return true if given subkey exists
200 \membersection{wxRegKey::HasSubKeys
}\label{wxregkeyhassubkeys
}
202 \constfunc{bool
}{HasSubKeys
}{\void}
204 Return true if any subkeys exist
207 \membersection{wxRegKey::IsEmpty
}\label{wxregkeyisempty
}
209 \constfunc{bool
}{IsEmpty
}{\void}
211 Return true if this Key is Empty, nothing under this key.
214 \membersection{wxRegKey::IsOpened
}\label{wxregkeyisopened
}
216 \constfunc{bool
}{IsOpened
}{\void}
218 Return true if the Key is Opened
221 \membersection{wxRegKey::Open
}\label{wxregkeyopen
}
223 \func{bool
}{Open
}{\void}
225 Explicitly open the key to be opened.
228 \membersection{wxRegKey::QueryValue
}\label{wxregkeyqueryvalue
}
230 \constfunc{bool
}{QueryValue
}{\param{const wxChar *
}{szValue
},
\param{wxString\&
}{strValue
}}
232 Retrieve the String Value
234 \constfunc{bool
}{QueryValue
}{\param{const wxChar *
}{szValue
},
\param{long *
}{plValue
}}
236 Retrive the Numeric Value
239 \membersection{wxRegKey::Rename
}\label{wxregkeyrename
}
241 \func{bool
}{Rename
}{\param{const wxChar *
}{ szNewName
}}
246 \membersection{wxRegKey::RenameValue
}\label{wxregkeyrenamevalue
}
248 \func{bool
}{RenameValue
}{\param{const wxChar *
}{szValueOld
},
\param{const wxChar *
}{szValueNew
}}
250 Rename a Value from Old to New
253 \membersection{wxRegKey::SetValue
}\label{wxregkeysetvalue
}
255 \func{bool
}{SetValue
}{\param{const wxChar *
}{szValue
},
\param{long
}{lValue
}}
257 Set the Numeric Value