<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TRegistry werte schreiben, aber wie?]]></title><description><![CDATA[<p>hallo zusammen hab mich ma mit dem schreiben von werten in die registry bschäftigt und in de hilfe auch direkt ein Beispiel gefunden aber es will nicht funktzionieren, leider. Hier der code der in der BCB-hilfe steht.</p>
<pre><code class="language-cpp">void __fastcall TForm1::WMEndSession(TWMEndSession &amp;Message)
{
  TRegistry *Reg = new TRegistry;
  try
  {
    Reg-&gt;RootKey = HKEY_CURRENT_USER;
    if (Reg-&gt;OpenKey(&quot;\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce&quot;, true)
    {
      Reg-&gt;WriteString(&quot;MyApp&quot;,&quot;\&quot;&quot; + ParamStr(0) + &quot;\&quot;&quot;);
      Reg-&gt;CloseKey();
    }
  }
  __finally
  {
    delete Reg;
    TForm::WMEndSession(Message);

  }
}

In order for this method to be called, it must be declared in your main form class as follows:

class PACKAGE TForm1 : public TForm

{
  ...
protected:

BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_ENDSESSION, TWMEndSession, WMEndSession)
END_MESSAGE_MAP(TForm)
};
</code></pre>
<p>Ich habe die Funktion in den Quellcode meiner Form gepackt und diese Funtkion in der header-file registriert, außerdem hab ich den 2.code in die headerdatei gepackt (protected....) so nun zeigt er mir trotzdem an das er tregistry und alles as dazu gehört nicht kennt. Gibts vielleicht noch einen header den ich vorher einbinden muss? bin dankbar für jede hilfe.<br />
mfg max</p>
<p>ps: so sieht mein header-file im moment aus:</p>
<pre><code class="language-cpp">#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;IdBaseComponent.hpp&gt;
#include &lt;IdComponent.hpp&gt;
#include &lt;IdTCPClient.hpp&gt;
#include &lt;IdTCPConnection.hpp&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TIdTCPClient *IdTCPClient1;
        void __fastcall FormCreate(TObject *Sender);
private:
        void __fastcall TForm1::WMEndSession(TWMEndSession &amp;Message);
	// User declarations
public:		// User declarations
        __fastcall TForm1(TComponent* Owner);

protected:

BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_ENDSESSION, TWMEndSession, WMEndSession)
END_MESSAGE_MAP(TForm)

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/159597/tregistry-werte-schreiben-aber-wie</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 02:41:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159597.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 16 Sep 2006 22:42:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TRegistry werte schreiben, aber wie? on Sat, 16 Sep 2006 22:42:24 GMT]]></title><description><![CDATA[<p>hallo zusammen hab mich ma mit dem schreiben von werten in die registry bschäftigt und in de hilfe auch direkt ein Beispiel gefunden aber es will nicht funktzionieren, leider. Hier der code der in der BCB-hilfe steht.</p>
<pre><code class="language-cpp">void __fastcall TForm1::WMEndSession(TWMEndSession &amp;Message)
{
  TRegistry *Reg = new TRegistry;
  try
  {
    Reg-&gt;RootKey = HKEY_CURRENT_USER;
    if (Reg-&gt;OpenKey(&quot;\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce&quot;, true)
    {
      Reg-&gt;WriteString(&quot;MyApp&quot;,&quot;\&quot;&quot; + ParamStr(0) + &quot;\&quot;&quot;);
      Reg-&gt;CloseKey();
    }
  }
  __finally
  {
    delete Reg;
    TForm::WMEndSession(Message);

  }
}

In order for this method to be called, it must be declared in your main form class as follows:

class PACKAGE TForm1 : public TForm

{
  ...
protected:

BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_ENDSESSION, TWMEndSession, WMEndSession)
END_MESSAGE_MAP(TForm)
};
</code></pre>
<p>Ich habe die Funktion in den Quellcode meiner Form gepackt und diese Funtkion in der header-file registriert, außerdem hab ich den 2.code in die headerdatei gepackt (protected....) so nun zeigt er mir trotzdem an das er tregistry und alles as dazu gehört nicht kennt. Gibts vielleicht noch einen header den ich vorher einbinden muss? bin dankbar für jede hilfe.<br />
mfg max</p>
<p>ps: so sieht mein header-file im moment aus:</p>
<pre><code class="language-cpp">#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include &lt;Classes.hpp&gt;
#include &lt;Controls.hpp&gt;
#include &lt;StdCtrls.hpp&gt;
#include &lt;Forms.hpp&gt;
#include &lt;IdBaseComponent.hpp&gt;
#include &lt;IdComponent.hpp&gt;
#include &lt;IdTCPClient.hpp&gt;
#include &lt;IdTCPConnection.hpp&gt;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
        TIdTCPClient *IdTCPClient1;
        void __fastcall FormCreate(TObject *Sender);
private:
        void __fastcall TForm1::WMEndSession(TWMEndSession &amp;Message);
	// User declarations
public:		// User declarations
        __fastcall TForm1(TComponent* Owner);

protected:

BEGIN_MESSAGE_MAP
  MESSAGE_HANDLER(WM_ENDSESSION, TWMEndSession, WMEndSession)
END_MESSAGE_MAP(TForm)

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1138803</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1138803</guid><dc:creator><![CDATA[Maxmann]]></dc:creator><pubDate>Sat, 16 Sep 2006 22:42:24 GMT</pubDate></item><item><title><![CDATA[Reply to TRegistry werte schreiben, aber wie? on Sun, 17 Sep 2006 06:43:19 GMT]]></title><description><![CDATA[<p>Ich würde erstmal überprüfen, ob du die Nachricht WMEndSession überhaupt bekommst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1138850</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1138850</guid><dc:creator><![CDATA[GCoder]]></dc:creator><pubDate>Sun, 17 Sep 2006 06:43:19 GMT</pubDate></item><item><title><![CDATA[Reply to TRegistry werte schreiben, aber wie? on Sun, 17 Sep 2006 15:26:55 GMT]]></title><description><![CDATA[<p>In der Hilfe zu TRegistry steht</p>
<blockquote>
<p><strong>Unit</strong><br />
Registry</p>
</blockquote>
<p>Das heisst im Klartext</p>
<pre><code class="language-cpp">#include &lt;registry.hpp&gt;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1139071</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1139071</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sun, 17 Sep 2006 15:26:55 GMT</pubDate></item></channel></rss>