<?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[registry lesen&#x2F;veraendern]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe vor ein Programm zuschreiben, welches Registryeintraege auslesen und aendern kann... Nun habe ich allerdings eine Frage, da ich immer den selben fehler bekomme.</p>
<p>Hier der Code:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;string.h&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{
	HKEY hKey;					//rootfolder
	hKey= HKEY_CURRENT_USER;

	LPCTSTR lpSubKey;			//subfolder
	lpSubKey = &quot;Test1&quot;;

	LPCTSTR lpValueName;		//Eintrag
	lpValueName = &quot;test&quot;;

	RegCreateKeyEx(hKey,lpSubKey,0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&amp;hKey,0);		//Erstelle/oeffne Ordner

	char buffer[80];				// einzugebnde Wert

	cin.get(buffer,79);				// Werteingabe

	BYTE cString[]= buffer;			//umwandlung von char zu BYTE funktioniert nicht

	RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,cString,strlen(buffer)+1);						//Erstelle/aendere Wert

	RegCloseKey(hKey);

return 0;
}
</code></pre>
<p>Fehler: main.cpp(25) : error C2440: 'initializing' : cannot convert from 'char [80]' to 'BYTE []'</p>
<p>da ich das Programm flexible halten will soll auch eine Eingabe erfolgen, in der man den Wert selber eingeben kann. Nun habe ich aber das Problem, dass 'strlen()'nur bei strings und nicht bei BYTE funktioniert, um den benoetigten Speicher zubestimmen...</p>
<p>wie es im Tutorial beschrieben ist, sollte es eigentlich moeglich sein:</p>
<pre><code>BYTE cString[]=&quot;Hallo, das ist der eigentliche Wert, der unter dem Namen EintragsName gespeicehrt wird&quot;;
RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,cString,strlen(cString)+1);
</code></pre>
<p>ist es aber nicht... Koennt ihr mir helfen?</p>
<p>mfg n0rse</p>
<p>ps.: Ich bin nach diesem Tutorial:</p>
<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39373.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39373.html</a></p>
<p>sowie dieser MSDN seite vorgegangen:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms724875(VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms724875(VS.85).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/217957/registry-lesen-veraendern</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 06:14:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/217957.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Jul 2008 11:04:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Mon, 14 Jul 2008 11:07:06 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe vor ein Programm zuschreiben, welches Registryeintraege auslesen und aendern kann... Nun habe ich allerdings eine Frage, da ich immer den selben fehler bekomme.</p>
<p>Hier der Code:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;string.h&gt;
#include &lt;iostream&gt;
using namespace std;

int main()
{
	HKEY hKey;					//rootfolder
	hKey= HKEY_CURRENT_USER;

	LPCTSTR lpSubKey;			//subfolder
	lpSubKey = &quot;Test1&quot;;

	LPCTSTR lpValueName;		//Eintrag
	lpValueName = &quot;test&quot;;

	RegCreateKeyEx(hKey,lpSubKey,0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&amp;hKey,0);		//Erstelle/oeffne Ordner

	char buffer[80];				// einzugebnde Wert

	cin.get(buffer,79);				// Werteingabe

	BYTE cString[]= buffer;			//umwandlung von char zu BYTE funktioniert nicht

	RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,cString,strlen(buffer)+1);						//Erstelle/aendere Wert

	RegCloseKey(hKey);

return 0;
}
</code></pre>
<p>Fehler: main.cpp(25) : error C2440: 'initializing' : cannot convert from 'char [80]' to 'BYTE []'</p>
<p>da ich das Programm flexible halten will soll auch eine Eingabe erfolgen, in der man den Wert selber eingeben kann. Nun habe ich aber das Problem, dass 'strlen()'nur bei strings und nicht bei BYTE funktioniert, um den benoetigten Speicher zubestimmen...</p>
<p>wie es im Tutorial beschrieben ist, sollte es eigentlich moeglich sein:</p>
<pre><code>BYTE cString[]=&quot;Hallo, das ist der eigentliche Wert, der unter dem Namen EintragsName gespeicehrt wird&quot;;
RegSetValueEx(hKey,&quot;EintragsName&quot;,0,REG_SZ,cString,strlen(cString)+1);
</code></pre>
<p>ist es aber nicht... Koennt ihr mir helfen?</p>
<p>mfg n0rse</p>
<p>ps.: Ich bin nach diesem Tutorial:</p>
<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39373.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39373.html</a></p>
<p>sowie dieser MSDN seite vorgegangen:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms724875(VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms724875(VS.85).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547032</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547032</guid><dc:creator><![CDATA[n0rse]]></dc:creator><pubDate>Mon, 14 Jul 2008 11:07:06 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Mon, 14 Jul 2008 11:18:07 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-18363.html" rel="nofollow">Jochen Kalmbach</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-58.html" rel="nofollow">C++/CLI mit .NET</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-4.html" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547040</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547040</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 14 Jul 2008 11:18:07 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Mon, 14 Jul 2008 15:25:57 GMT]]></title><description><![CDATA[<p>Hallo n0rse,</p>
<p>vereinbare den Namespace <strong>Microsoft::Win32</strong>.</p>
<p>using namespace Microsoft::Win32;</p>
<p>Gruß, Doug_HH</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547186</guid><dc:creator><![CDATA[Doug_HH]]></dc:creator><pubDate>Mon, 14 Jul 2008 15:25:57 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Mon, 14 Jul 2008 17:00:53 GMT]]></title><description><![CDATA[<p>ich hab das mal probiert, dann gibt mir der compiler immer folgenden fehler:</p>
<p>error C2871: 'win32' : a namespace with this name does not exist</p>
<p>was soll mir dieser namespace denn helfen, kenne mich damit nicht aus...</p>
<p>vielen dank schonmal</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547245</guid><dc:creator><![CDATA[n0rse]]></dc:creator><pubDate>Mon, 14 Jul 2008 17:00:53 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Mon, 14 Jul 2008 18:44:08 GMT]]></title><description><![CDATA[<p>Sorry, hab zu schnell geantwortet.<br />
Hier eine kurze MSDN Hilfe.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms942534.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms942534.aspx</a></p>
<p>Oder die Möglichkeit mit <strong>Microsoft::Win32</strong>;</p>
<p>Setzen...</p>
<pre><code class="language-cpp">Registry::SetValue(&quot;HKEY_CURRENT_USER\\Test\\Programm\\Datenbank&quot;,&quot;DatabaseConnection&quot;,&quot;Eintrag&quot;);
</code></pre>
<p>Auslesen...</p>
<pre><code class="language-cpp">String^ datenBankName = Convert::ToString(Registry::GetValue(&quot;HKEY_CURRENT_USER\\Test\\Programm\\Datenbank&quot;,&quot;DatabaseConnection&quot;,&quot;&quot;));//Registry einlesen
</code></pre>
<p>Gruß, Doug_HH</p>
<p>Edit*/ Sehe ich jetzt erst, bin ja im falschen Forum, hab Dir zum Teil <strong>C++/CLI</strong> Hilfe gegeben...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547308</guid><dc:creator><![CDATA[Doug_HH]]></dc:creator><pubDate>Mon, 14 Jul 2008 18:44:08 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Tue, 15 Jul 2008 10:22:17 GMT]]></title><description><![CDATA[<p>hmm ich habe nun 2 probleme, mein programm laeuft nun soweit wie ich es haben will, nur erfuellt es nicht seinen zweck <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Folgende Fehler:</p>
<p>1.) Wenn ich die *.exe auf einem anderen Rechner starten moechte kommt folgende Fehlermeldung:</p>
<p>This application has failed to start because the application configuration is incorrect.Reinstalling the application may fix this problem</p>
<p>2.) Das Programm aendert die Registry so wie es sein sollte, das ist schonmal gut. Allerdings sollten diese Registryeintraege den Gateway aendern, wie hier beschrieben: <a href="http://www.codeguru.com/cpp/i-n/internet/generalinternet/article.php/c3459__1" rel="nofollow">http://www.codeguru.com/cpp/i-n/internet/generalinternet/article.php/c3459__1</a><br />
Leider aendert das Programm nur den Registryeintrag, aber Windows scheint sich darum nicht zukuemmern, der Registyeintrag bleibt auch nach einem neustart geaendert, allerdings aendert sich der Gateway nicht.</p>
<p>hoffe ihr koennt mir weiter helfen, c++ ist fuer mich sehr neu und das sollte mein erstes Projekt sein.</p>
<p>mfg n0rse</p>
<p>edit: was ich vergessen habe: zu 1.) Wenn ich die *.exe auf meinem Rechner starte funktioniert das Programm. Denke mal, dass ich irgendwas beim erstellen der exe falsch mache</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547564</guid><dc:creator><![CDATA[n0rse]]></dc:creator><pubDate>Tue, 15 Jul 2008 10:22:17 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Tue, 15 Jul 2008 16:26:21 GMT]]></title><description><![CDATA[<p>&quot;Projekt&quot; -&gt; Eigenschaften -&gt; C/C++ -&gt; Codegenerierung -&gt; Laufzeitbibliothek</p>
<p>diese auf Multithreaded stellen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1547775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1547775</guid><dc:creator><![CDATA[gosha16]]></dc:creator><pubDate>Tue, 15 Jul 2008 16:26:21 GMT</pubDate></item><item><title><![CDATA[Reply to registry lesen&#x2F;veraendern on Wed, 16 Jul 2008 09:11:59 GMT]]></title><description><![CDATA[<p>vielen dank, das funktioniert schonmal, nun muss ich ma wegen dem anderen prob schauen</p>
<p>mfg n0rse</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1548108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1548108</guid><dc:creator><![CDATA[n0rse]]></dc:creator><pubDate>Wed, 16 Jul 2008 09:11:59 GMT</pubDate></item></channel></rss>