X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5c468483d43741305217e0a9acc42c7154dd166..073b976d01c33bc71babbc1a6085c26e2506e12d:/interface/wx/msw/registry.h diff --git a/interface/wx/msw/registry.h b/interface/wx/msw/registry.h index db873eb93d..d3447ea75e 100644 --- a/interface/wx/msw/registry.h +++ b/interface/wx/msw/registry.h @@ -35,30 +35,28 @@ @b Example: @code - wxRegKey *key = new wxRegKey("HKEY_LOCAL_MACHINE\\Software\\MyKey"); + // This assume that the key already exists, use HasSubKey() to check + // for the key existence if necessary. + wxRegKey key(wxRegKey::HKLM, "Software\\MyKey"); - // Create the key if it does not exist. - if( !key->Exists() ) - key->Create(); - - // Create a new value "MYVALUE" and set it to 12. - key->SetValue("MYVALUE", 12); + // Create a new value "MyValue" and set it to 12. + key.SetValue("MyValue", 12); // Read the value back. long value; - key->QueryValue("MYVALUE", &value); + key.QueryValue("MyValue", &value); wxMessageBox(wxString::Format("%d", value), "Registry Value", wxOK); // Get the number of subkeys and enumerate them. size_t subkeys; - key->GetKeyInfo(&subkeys, NULL, NULL, NULL); + key.GetKeyInfo(&subkeys, NULL, NULL, NULL); wxString key_name; - key->GetFirstKey(key_name, 1); + key.GetFirstKey(key_name, 1); for(int i = 0; i < subkeys; i++) { wxMessageBox(key_name, "Subkey Name", wxOK); - key->GetNextKey(key_name, 1); + key.GetNextKey(key_name, 1); } @endcode @@ -290,7 +288,7 @@ public: /** Returns @true if any subkeys exist. */ - bool HasSubKeys() const; + bool HasSubkeys() const; /** Returns @true if the value exists.