<?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[GetWindowTextLength stürtzt ab]]></title><description><![CDATA[<p>Tach</p>
<pre><code class="language-cpp">LPSTR  daten;
DWORD  TextLange;
       TextLange = GetWindowTextLength(hwndEdit);

GetWindowText(hwndEdit, daten, TextLange+1); //Hir stürtzt das Programm ab :(
</code></pre>
<p>Warum stürtzt &quot;GetWindowsText()&quot; ab??<br />
(das +1 habe ich geschrieben, weil ich das so, in nem anderen Programm gesehen habe, aber wenn ich es weglasse, stürtzt es Trotzdem ab)</p>
<p>!!Die variable &quot;daten&quot; wird Trotz Absturtz &quot;gefüllt&quot;.</p>
<p>Wenn ich &quot;GetWindowText()&quot; in Kommentare setzte, gibt's kein Absturtz, deshalb bin ich mir sicher, das es an der Funktion liegt</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/85019/getwindowtextlength-stürtzt-ab</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 10:23:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/85019.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Sep 2004 17:51:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sat, 04 Sep 2004 17:51:48 GMT]]></title><description><![CDATA[<p>Tach</p>
<pre><code class="language-cpp">LPSTR  daten;
DWORD  TextLange;
       TextLange = GetWindowTextLength(hwndEdit);

GetWindowText(hwndEdit, daten, TextLange+1); //Hir stürtzt das Programm ab :(
</code></pre>
<p>Warum stürtzt &quot;GetWindowsText()&quot; ab??<br />
(das +1 habe ich geschrieben, weil ich das so, in nem anderen Programm gesehen habe, aber wenn ich es weglasse, stürtzt es Trotzdem ab)</p>
<p>!!Die variable &quot;daten&quot; wird Trotz Absturtz &quot;gefüllt&quot;.</p>
<p>Wenn ich &quot;GetWindowText()&quot; in Kommentare setzte, gibt's kein Absturtz, deshalb bin ich mir sicher, das es an der Funktion liegt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/599595</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599595</guid><dc:creator><![CDATA[RedEagle]]></dc:creator><pubDate>Sat, 04 Sep 2004 17:51:48 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sat, 04 Sep 2004 18:02:19 GMT]]></title><description><![CDATA[<p>Du hast für Daten keinen Speicher angefordert. Dann schreibt die Funktion ins Nirvana und das war's. Also sowas wie</p>
<p>Daten = malloc (TextLange);</p>
<p>machen. Free hinterher nicht vergessen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/599603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599603</guid><dc:creator><![CDATA[7H3 N4C3R]]></dc:creator><pubDate>Sat, 04 Sep 2004 18:02:19 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sat, 04 Sep 2004 18:09:42 GMT]]></title><description><![CDATA[<p>invalid conversion from `void*' to `CHAR*'<br />
geht nciht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Habe sowas ncoh nie gemacht</p>
<p>geht das so mit dem free??<br />
free(Daten);<br />
??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/599606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599606</guid><dc:creator><![CDATA[RedEagle]]></dc:creator><pubDate>Sat, 04 Sep 2004 18:09:42 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sat, 04 Sep 2004 18:44:47 GMT]]></title><description><![CDATA[<p>Wenn du einen Smart-Pointer verwendest, z.B. auto_ptr aus der STL gehst du der Gefahr von Memory Leaks aus dem Weg. <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>
<pre><code class="language-cpp">#include &lt;memory&gt;
using namespaces std;

void dummy()
{
  ...
  DWORD length = GetWindowTextLength(hwndEdit) + 1;
  auto_ptr&lt;char&gt; buffer(new char[length]);
  GetWindowText(buffer.get(), length);
  ...
}
</code></pre>
<p>mfg JJ</p>
]]></description><link>https://www.c-plusplus.net/forum/post/599623</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599623</guid><dc:creator><![CDATA[John Doe]]></dc:creator><pubDate>Sat, 04 Sep 2004 18:44:47 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sat, 04 Sep 2004 19:54:30 GMT]]></title><description><![CDATA[<p>Ich kappier den Code überhaupt nicht.</p>
<p>so habe ich es jetzt im code stehn:</p>
<pre><code class="language-cpp">LPSTR  daten;
        //DWORD  TextLange;

        //TextLange = GetWindowTextLength(hwndEdit);
        //daten = malloc (TextLange);
        DWORD TextLange = GetWindowTextLength(hwndEdit) + 1;
        auto_ptr&lt;char&gt; buffer(new char[TextLange]);
        //GetWindowText(buffer.get(), length);  //PUNKT A
</code></pre>
<p>Und es Stürtzt ab.<br />
Wenn ich PUNKT A nciht in Kommentare setzte, wird garnicht erst kompiliert</p>
<p>also die Lösung von &quot;7H3 N4C3R&quot; gefällt mir besser, da ich das halbwegs verstehe, und auch später mal einsetzen kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/599671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599671</guid><dc:creator><![CDATA[RedEagle]]></dc:creator><pubDate>Sat, 04 Sep 2004 19:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sun, 05 Sep 2004 06:58:10 GMT]]></title><description><![CDATA[<p>Habs jetzt so gemacht:<br />
daten = (LPSTR)GlobalAlloc(GPTR, TextLange + 1);</p>
<p>(ich habe auch den Speicher wieder Ffreigegeben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/599750</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599750</guid><dc:creator><![CDATA[RedEagle]]></dc:creator><pubDate>Sun, 05 Sep 2004 06:58:10 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sun, 05 Sep 2004 10:31:08 GMT]]></title><description><![CDATA[<p>...oder einfach über new und delete[] <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>
]]></description><link>https://www.c-plusplus.net/forum/post/599817</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599817</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sun, 05 Sep 2004 10:31:08 GMT</pubDate></item><item><title><![CDATA[Reply to GetWindowTextLength stürtzt ab on Sun, 05 Sep 2004 10:58:15 GMT]]></title><description><![CDATA[<p>stimmt. Daran habe ich garnicht gedacht <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>
]]></description><link>https://www.c-plusplus.net/forum/post/599836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/599836</guid><dc:creator><![CDATA[RedEagle]]></dc:creator><pubDate>Sun, 05 Sep 2004 10:58:15 GMT</pubDate></item></channel></rss>