Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Include the Registry.hpp file:</p> <pre><code>#include &lt;Registry.hpp&gt; </code></pre> <p>Then in any function you have, you can write the following to read the value:</p> <pre><code>String __fastcall ReadRegistryString(const String &amp;key, const String &amp;name, const String &amp;def) { TRegistry *reg = new TRegistry(); String result; try { reg-&gt;RootKey = HKEY_CURRENT_USER; if (reg-&gt;OpenKeyReadOnly(key)) { result = reg-&gt;ReadString(name, def); reg-&gt;CloseKey(); } } __finally { delete reg; } return result; } </code></pre> <p>So reading the value should be as easy as:</p> <pre><code>ShowMessage(ReadRegistryString("Options", "Last Directory", "none")); </code></pre> <p>You can use the following to write the value:</p> <pre><code>void __fastcall WriteRegistryString(const String &amp;key, const String &amp;name, const String &amp;value) { TRegistry *reg = new TRegistry(); try { reg-&gt;RootKey = HKEY_CURRENT_USER; if (reg-&gt;OpenKey(key, true)) { reg-&gt;WriteString(name, value); reg-&gt;CloseKey(); } } __finally { delete reg; } } </code></pre> <p>Should be self explaining, remembering the try ... finally is actually really helpful when using the VCL TRegistry class.</p> <p><strong>Edit</strong></p> <p>I've heard that .ini files are stored in the registry in Windows, so if you want the speed advantage of ini files you should call them something else - like .cfg</p> <p>This is something I've heard from an although reliable source, I haven't tested it myself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload