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. One can create, query and delete registry keys using this class.
16 The Windows registry is easy to understand. There are five registry keys, namely:
18 \begin{enumerate
}\itemsep=
0pt
19 \item HKEY
\_CLASSES\_ROOT (HKCR)
20 \item HKEY
\_CURRENT\_USER (HKCU)
21 \item HKEY
\_LOCAL\_MACHINE (HKLM)
22 \item HKEY
\_CURRENT\_CONFIG (HKCC)
23 \item HKEY
\_USERS (HKU)
26 After creating a key, it can hold a value. The values can be:
28 \begin{enumerate
}\itemsep=
0pt
32 \item Multi String Value
33 \item Expandable String Value
36 \wxheading{Derived from
}
40 \wxheading{Include files
}
47 wxRegKey *pRegKey = new wxRegKey("HKEY_LOCAL_MACHINE\
\Software\
\MyKey");
49 //will create the Key if it does not exist
50 if( !pRegKey->Exists() )
53 //will create a new value MYVALUE and set it to
12
54 pRegKey->SetValue("MYVALUE",
12);
56 //Query for the Value and Retrieve it
59 pRegKey->QueryValue("MYVALUE",&lMyVal);
60 strTemp.Printf("
%d",lMyVal);
61 wxMessageBox(strTemp,"Registry Value",
0,this);
63 //Retrive the number of SubKeys and enumerate them
65 pRegKey->GetKeyInfo(&nSubKeys,NULL,NULL,NULL);
67 pRegKey->GetFirstKey(strTemp,
1);
68 for(int i=
0;i<nSubKeys;i++)
70 wxMessageBox(strTemp,"SubKey Name",
0,this);
71 pRegKey->GetNextKey(strTemp,
1);
75 \latexignore{\rtfignore{\wxheading{Members
}}}
77 \membersection{wxRegKey::wxRegKey
}\label{wxregkeyctor
}
79 \func{}{wxRegKey
}{\void}
81 The Constructor to set to HKCR
83 \func{}{wxRegKey
}{\param{const wxString\&
}{ strKey
}}
85 The constructor to set the full name of the key.
87 \func{}{wxRegKey
}{\param{const wxRegKey\&
}{ keyParent
},
\param{const wxString\&
}{ strKey
}}
89 The constructor to set the full name of the key under a previously created parent.
91 \membersection{wxRegKey::Close
}\label{wxregkeyclose
}
93 \func{void
}{Close
}{\void}
97 \membersection{wxRegKey::Create
}\label{wxregkeycreate
}
99 \func{bool
}{Create
}{\param{bool
}{bOkIfExists = true
}}
101 Creates the key. Will fail if the key already exists and
{\it bOkIfExists
} is false.
103 \membersection{wxRegKey::DeleteSelf
}\label{wxregkeydeleteself
}
105 \func{void
}{DeleteSelf
}{\void}
107 Deletes this key and all of its subkeys and values recursively.
109 \membersection{wxRegKey::DeleteKey
}\label{wxregkeydeletekey
}
111 \func{void
}{DeleteKey
}{\param{const wxChar *
}{szKey
}}
113 Deletes the subkey with all of its subkeys/values recursively.
115 \membersection{wxRegKey::DeleteValue
}\label{wxregkeydeletevalue
}
117 \func{void
}{DeleteValue
}{\param{const wxChar *
}{szKey
}}
119 Deletes the named value.
121 \membersection{wxRegKey::Exists
}\label{wxregkeyexists
}
123 \constfunc{static bool
}{Exists
}{\void}
125 Returns true if the key exists.
127 \membersection{wxRegKey::GetName
}\label{wxregkeygetname
}
129 \constfunc{wxString
}{GetName
}{\param{bool
}{bShortPrefix = true
}}
131 Gets the name of the registry key.
133 \membersection{wxRegKey::GetFirstKey
}\label{wxregkeygetfirstkey
}
135 \func{bool
}{GetKeyValue
}{\param{wxString\&
}{ strKeyName
},
\param{long\&
}{ lIndex
}}
139 \membersection{wxRegKey::GetFirstValue
}\label{wxregkeygetfirstvalue
}
141 \func{bool
}{GetFirstValue
}{\param{wxString\&
}{ strValueName
},
\param{long\&
}{ lIndex
}}
143 Gets the first value of this key.
145 \membersection{wxRegKey::GetKeyInfo
}\label{wxregkeygetkeyinfo
}
147 \constfunc{bool
}{Exists
}{\param{size
\_t *
}{pnSubKeys
},
\param{size
\_t *
}{pnValues
},
\param{size
\_t *
}{pnMaxValueLen
}}
149 Gets information about the key.
151 \wxheading{Parameters
}
153 \docparam{pnSubKeys
}{The number of subkeys.
}
155 \docparam{pnMaxKeyLen
}{The maximum length of the subkey name.
}
157 \docparam{pnValues
}{The number of values.
}
159 \membersection{wxRegKey::GetNextKey
}\label{wxregkeygetnextkey
}
161 \constfunc{bool
}{GetNextKey
}{\param{wxString\&
}{ strKeyName
},
\param{long\&
}{ lIndex
}}
165 \membersection{wxRegKey::GetNextValue
}\label{wxregkeygetnextvalue
}
167 \constfunc{bool
}{GetNextValue
}{\param{wxString\&
}{ strValueName
},
\param{long\&
}{ lIndex
}}
169 Gets the next key value for this key.
171 \membersection{wxRegKey::HasValue
}\label{wxregkeyhasvalue
}
173 \constfunc{bool
}{HasValue
}{\param{const wxChar *
}{szValue
}}
175 Returns true if the value exists.
177 \membersection{wxRegKey::HasValues
}\label{wxregkeyhasvalues
}
179 \constfunc{bool
}{HasValues
}{\void}
181 Returns true if any values exist.
183 \membersection{wxRegKey::HasSubKey
}\label{wxregkeyhassubkey
}
185 \constfunc{bool
}{HasSubKey
}{\param{const wxChar *
}{szKey
}}
187 Returns true if given subkey exists.
189 \membersection{wxRegKey::HasSubKeys
}\label{wxregkeyhassubkeys
}
191 \constfunc{bool
}{HasSubKeys
}{\void}
193 Returns true if any subkeys exist.
195 \membersection{wxRegKey::IsEmpty
}\label{wxregkeyisempty
}
197 \constfunc{bool
}{IsEmpty
}{\void}
199 Returns true if this key is empty, nothing under this key.
201 \membersection{wxRegKey::IsOpened
}\label{wxregkeyisopened
}
203 \constfunc{bool
}{IsOpened
}{\void}
205 Returns true if the key is opened.
207 \membersection{wxRegKey::Open
}\label{wxregkeyopen
}
209 \func{bool
}{Open
}{\void}
211 Explicitly opens the key to be opened.
213 \membersection{wxRegKey::QueryValue
}\label{wxregkeyqueryvalue
}
215 \constfunc{bool
}{QueryValue
}{\param{const wxChar *
}{szValue
},
\param{wxString\&
}{ strValue
}}
217 Retrieves the string value.
219 \constfunc{bool
}{QueryValue
}{\param{const wxChar *
}{szValue
},
\param{long *
}{plValue
}}
221 Retrieves the numeric value.
223 \membersection{wxRegKey::Rename
}\label{wxregkeyrename
}
225 \func{bool
}{Rename
}{\param{const wxChar *
}{ szNewName
}}
229 \membersection{wxRegKey::RenameValue
}\label{wxregkeyrenamevalue
}
231 \func{bool
}{RenameValue
}{\param{const wxChar *
}{szValueOld
},
\param{const wxChar *
}{szValueNew
}}
235 \membersection{wxRegKey::SetValue
}\label{wxregkeysetvalue
}
237 \func{bool
}{SetValue
}{\param{const wxChar *
}{szValue
},
\param{long
}{ lValue
}}
239 Sets the numeric value.