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,
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)
28 After creating a Key , it can hold a Value. The Values can be ,
30 \begin{enumerate
}\itemsep=
0pt
34 \item Multi String Value
35 \item Expandable String Value
38 \wxheading{Derived from
}
42 \wxheading{Include files
}
49 wxRegKey *pRegKey = new wxRegKey("HKEY_LOCAL_MACHINE\
\Software\
\MyKey");
51 //will create the Key if it does not exist
52 if( !pRegKey->Exists() )
55 //will create a new value MYVALUE and set it to
12
56 pRegKey->SetValue("MYVALUE",
12);
58 //Query for the Value and Retrieve it
61 pRegKey->QueryValue("MYVALUE",&lMyVal);
62 strTemp.Printf("
%d",lMyVal);
63 wxMessageBox(strTemp,"Registry Value",
0,this);
65 //Retrive the number of SubKeys and enumerate them
67 pRegKey->GetKeyInfo(&nSubKeys,NULL,NULL,NULL);
69 pRegKey->GetFirstKey(strTemp,
1);
70 for(int i=
0;i<nSubKeys;i++)
72 wxMessageBox(strTemp,"SubKey Name",
0,this);
73 pRegKey->GetNextKey(strTemp,
1);
77 \latexignore{\rtfignore{\wxheading{Members
}}}
79 \membersection{wxRegKey::wxRegKey
}\label{wxregkeyctor
}
81 \func{}{wxRegKey
}{\void}
83 The Constructor to set to HKCR
85 \func{}{wxRegKey
}{\param{const wxString\&
}{strKey
}}
87 The constructor to set the full name of the key.
89 \func{}{wxRegKey
}{\param{const wxRegKey\&
}{keyParent
}\param{const wxString\&
}{strKey
}}
91 The constructor to set the full name of the key under previously created keyParent.
94 \membersection{wxRegKey::Close
}\label{wxregkeyclose
}
96 \func{void
}{Close
}{\void}
101 \membersection{wxRegKey::Create
}\label{wxregkeycreate
}
103 \func{bool
}{Create
}{\param{bool
}{bOkIfExists = true
}}
105 Create the Key,Will fail if the Key already exists and !bOkIfExists
108 \membersection{wxRegKey::DeleteSelf
}\label{wxregkeydeleteself
}
110 \func{void
}{DeleteSelf
}{\void}
112 Deletes this Key and all of it's subkeys/values recursively
115 \membersection{wxRegKey::DeleteKey
}\label{wxregkeydeletekey
}
117 \func{void
}{DeleteKey
}{\param{const wxChar *
}{szKey
}}
119 Deletes the subkey with all of it's subkeys/values recursively
122 \membersection{wxRegKey::DeleteValue
}\label{wxregkeydeletevalue
}
124 \func{void
}{DeleteValue
}{\param{const wxChar *
}{szKey
}}
126 Deletes the named value
129 \membersection{wxRegKey::Exists
}\label{wxregkeyexists
}
131 \constfunc{static bool
}{Exists
}{\void}
133 Return true if the Key Exists
136 \membersection{wxRegKey::GetName
}\label{wxregkeygetname
}
138 \constfunc{wxString
}{GetName
}{\param{bool
}{bShortPrefix = true
}}
140 Get the name of the Registry Key
143 \membersection{wxRegKey::GetFirstKey
}\label{wxregkeygetfirstkey
}
145 \func{bool
}{GetKeyValue
}{\param{wxString\&
}{strKeyName
},
\param{long\&
}{lIndex
}}
150 \membersection{wxRegKey::GetFirstValue
}\label{wxregkeygetfirstvalue
}
152 \func{bool
}{GetFirstValue
}{\param{wxString\&
}{strValueName
},
\param{long\&
}{lIndex
}}
154 Get the First Value of this Key
157 \membersection{wxRegKey::GetKeyInfo
}\label{wxregkeygetkeyinfo
}
159 \constfunc{bool
}{Exists
}{\param{size
\_t *
}{pnSubKeys
},
\param{size
\_t *
}{pnValues
},
\param{size
\_t *
}{pnMaxValueLen
}}
161 Get the info about the key
163 \docparam{pnSubKeys
}{Number of SubKeys
}
164 \docparam{pnMaxKeyLen
}{Max length of SubKey name
}
165 \docparam{pnValues
}{Number of Values
}
168 \membersection{wxRegKey::GetNextKey
}\label{wxregkeygetnextkey
}
170 \constfunc{bool
}{GetNextKey
}{\param{wxString\&
}{strKeyName
},
\param{long\&
}{lIndex
}}
172 Get the next Key of this Key
175 \membersection{wxRegKey::GetNextValue
}\label{wxregkeygetnextvalue
}
177 \constfunc{bool
}{GetNextValue
}{\param{wxString\&
}{strValueName
},
\param{long\&
}{lIndex
}}
179 Get the Next Key Value of this Key
182 \membersection{wxRegKey::HasValue
}\label{wxregkeyhasvalue
}
184 \constfunc{bool
}{HasValue
}{\param{const wxChar *
}{szValue
}}
186 Return true if the value exists
189 \membersection{wxRegKey::HasValues
}\label{wxregkeyhasvalues
}
191 \constfunc{bool
}{HasValues
}{\void}
193 Return true if any values exist
196 \membersection{wxRegKey::HasSubKey
}\label{wxregkeyhassubkey
}
198 \constfunc{bool
}{HasSubKey
}{\param{const wxChar *
}{szKey
}}
200 Return true if given subkey exists
203 \membersection{wxRegKey::HasSubKeys
}\label{wxregkeyhassubkeys
}
205 \constfunc{bool
}{HasSubKeys
}{\void}
207 Return true if any subkeys exist
210 \membersection{wxRegKey::IsEmpty
}\label{wxregkeyisempty
}
212 \constfunc{bool
}{IsEmpty
}{\void}
214 Return true if this Key is Empty, nothing under this key.
217 \membersection{wxRegKey::IsOpened
}\label{wxregkeyisopened
}
219 \constfunc{bool
}{IsOpened
}{\void}
221 Return true if the Key is Opened
224 \membersection{wxRegKey::Open
}\label{wxregkeyopen
}
226 \func{bool
}{Open
}{\void}
228 Explicitly open the key to be opened.
231 \membersection{wxRegKey::QueryValue
}\label{wxregkeyqueryvalue
}
233 \constfunc{bool
}{QueryValue
}{\param{const wxChar *
}{szValue
},
\param{wxString\&
}{strValue
}}
235 Retrieve the String Value
237 \constfunc{bool
}{QueryValue
}{\param{const wxChar *
}{szValue
},
\param{long *
}{plValue
}}
239 Retrive the Numeric Value
242 \membersection{wxRegKey::Rename
}\label{wxregkeyrename
}
244 \func{bool
}{Rename
}{\param{const wxChar *
}{ szNewName
}}
249 \membersection{wxRegKey::RenameValue
}\label{wxregkeyrenamevalue
}
251 \func{bool
}{RenameValue
}{\param{const wxChar *
}{szValueOld
},
\param{const wxChar *
}{szValueNew
}}
253 Rename a Value from Old to New
256 \membersection{wxRegKey::SetValue
}\label{wxregkeysetvalue
}
258 \func{bool
}{SetValue
}{\param{const wxChar *
}{szValue
},
\param{long
}{lValue
}}
260 Set the Numeric Value