<?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[Mehrzeiliges Editfeld leeren]]></title><description><![CDATA[<p>Hallo mal wieder,</p>
<p>ganz simples Problem:</p>
<p>Ein mit ES_MULTILINE erzeugtes Editfeld soll geleert werden.</p>
<p>Doch mit SetWindowText(hEdit,NULL) werden Zeilenbrüche nicht ausradiert.</p>
<p>Wie leer ich das ganz?</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/214809/mehrzeiliges-editfeld-leeren</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 20:58:51 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/214809.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Jun 2008 14:18:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 14:18:41 GMT]]></title><description><![CDATA[<p>Hallo mal wieder,</p>
<p>ganz simples Problem:</p>
<p>Ein mit ES_MULTILINE erzeugtes Editfeld soll geleert werden.</p>
<p>Doch mit SetWindowText(hEdit,NULL) werden Zeilenbrüche nicht ausradiert.</p>
<p>Wie leer ich das ganz?</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521813</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521813</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Tue, 03 Jun 2008 14:18:41 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 14:23:07 GMT]]></title><description><![CDATA[<p>SetWindowText(hEdit, TEXT(&quot;&quot;));</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521816</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521816</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Tue, 03 Jun 2008 14:23:07 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 16:03:41 GMT]]></title><description><![CDATA[<blockquote>
<p><em>WinNT.h</em></p>
<p>[...]</p>
<p>#define __TEXT(quote) quote // r_winnt</p>
<p>[...]</p>
<p>#define TEXT(quote) __TEXT(quote) // r_winnt</p>
<p>[...]</p>
</blockquote>
<p>Sollte heißen TEXT(&quot;&quot;) ist identisch mit &quot;&quot;.<br />
Wofür gibts sowas dann?</p>
<p>Danke aber das funktioniert leider genauso wenig ...</p>
<p>Ich habe immernoch meine Zeilenumbrüche im hEdit ...</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521873</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Tue, 03 Jun 2008 16:03:41 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 16:23:16 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">SendMessage(hWndEdit, EM_SETSEL, 0, -1);
SendMessage(hWndEdit, EM_REPLACESEL, FALSE, (LPARAM) _T(&quot;&quot;));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1521884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521884</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Tue, 03 Jun 2008 16:23:16 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 16:23:54 GMT]]></title><description><![CDATA[<p>TEXT ist ein Makro was -bei Compilierung mit UNICODE- ein 'L' vor Deinen String setzt. Das sorgt dafür, dass Dein Compiler diesen als wchar_t-C-String interpretiert. Macht also Sinn, weil man dann einfach zwischen dem Zeichensatz wechseln kann.</p>
<p>SetWindowText(hEdit, NULL); ist eigentlich richtig, zeig mal Deinen Code. Ist hEdit evtl. nicht mehr gültig (Standardfehler <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="😉"
    /> )? Hast mal den Return-Wert und ggfs. GetLastError geprüft?</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/17633">@sri</a>: Komplizierter geht es eigentlich auch net^^.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521885</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521885</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Tue, 03 Jun 2008 16:23:54 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 17:13:41 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">WNDPROC EditProc;

LRESULT CALLBACK WndEdit(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
    static klasse* instanz = 0;
    if (instanz == 0) instanz = (klasse*)GetWindowLong(hWnd,GWL_USERDATA);

    if (msg == WM_KEYDOWN &amp;&amp; wParam == VK_RETURN)
    {
        if (GetAsyncKeyState(VK_CONTROL) &amp; (1 &lt;&lt; 15))
        {
            //verarbeite Text aus hEdit (GetWindowText() usw ...) und dann:
            SetWindowText(instanz-&gt;hEdit,NULL);
            //NULL oder TEXT(&quot;&quot;) oder nur &quot;&quot;, einerlei ...
        }
    }

    return CallWindowProc(EditProc,hWnd,msg,wParam,lParam);
}

LRESULT CALLBACK WndMain(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
    static klasse* instanz = 0;
    if (msg == WM_CREATE &amp;&amp; instanz == 0) instanz = (klasse*)LPCREATESTRUCT(lParam)-&gt;lpCreateParams;

    if (msg == WM_CREATE)
    {
        instanz-&gt;hEdit = CreateWindow(&quot;EDIT&quot;,NULL,WS_CHILD|WS_VISIBLE|ES_MULTILINE|WS_VSCROLL|ES_AUTOVSCROLL,10,10,200,100,hWnd,NULL,hInst,NULL);
        SetWindowLong(instanz-&gt;hEdit,GWL_USERDATA,(long)LPVOID(instanz));
        EditProc = (WNDPROC)SetWindowLong(instanz-&gt;hEdit,GWL_WNDPROC,(long)WndEdit);
    }

    return DefWindowProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
}

int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
    klasse instanz;
    instanz.hEdit = 0; // HWND klasse::hEdit

    HWND hWnd = CreateWindow(&quot;MAIN&quot;,&quot;juhu&quot;,WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,100,100,600,450,NULL,NULL,hInstance,&amp;instanz);

    // Nachrichten-Verarbeitung
}
</code></pre>
<p>Wenn Ihr folgen konntet, so sehr Ihr, dass hEdit im Subclassing ist und bei der Tastenkombination STRG+ENTER den Text verarbeitet und dann das Textfeld wieder leert - bzw nicht ganz, weil eben immer ein Zeilenumbruch drin bleibt.</p>
<p>Hm ... mit dem Satz hab ich mir grad selbst was beantwortet.<br />
^^Wie ich sagte bleibt ein Zeilenumbruch im Edit, dh es ist naheliegend, dass erst alles rausradiert wird und <strong>danach</strong> - obwohl VK_RETURN abgefangen wurde - der durch ENTER erzeugte Zeilenumbruch ins Editfeld geschrieben wird.</p>
<p>Sry, mir fällt auf, dass das mit SetWindowText() nichts zu tun hat ... ^^</p>
<p>Die Frage ist jetzt dann wohl folgende:</p>
<p>Ich habe VK_RETURN erfolgreich abgefangen, wie kann ich jedoch verhindern, dass der normalerweise durch VK_RETURN erzeugte Zeilenumbruch <strong>nicht</strong> mehr geschrieben wird?</p>
<p>Danke schonmal für Eure Hilfe!</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521898</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521898</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Tue, 03 Jun 2008 17:13:41 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 17:23:34 GMT]]></title><description><![CDATA[<p>CodeFinder schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/17633">@sri</a>: Komplizierter geht es eigentlich auch net^^.</p>
</blockquote>
<p>War als Alternative gedacht, da SetWindowText ja angeblich nicht ging.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521912</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Tue, 03 Jun 2008 17:23:34 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Tue, 03 Jun 2008 17:26:35 GMT]]></title><description><![CDATA[<p>Jep, danke dafür <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>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1521915</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1521915</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Tue, 03 Jun 2008 17:26:35 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Wed, 04 Jun 2008 13:40:05 GMT]]></title><description><![CDATA[<p>Ok ich frag nochmal ganz explizit ohne Code - da muss es doch eine Lösung geben ...</p>
<p>Folgendes:</p>
<p>Ich habe mit SetWindowLong mein HWND hEdit gesubclassed und fange in der WNDPROC die Taste Enter (VK_RETURN) ab. Allerdings wird der Zeilenumbruch trotzdem in mein Editfeld geschrieben.</p>
<p>Wie kann ich das verhindern?</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1522519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1522519</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Wed, 04 Jun 2008 13:40:05 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Wed, 04 Jun 2008 13:45:06 GMT]]></title><description><![CDATA[<p>Im obigen Codeschnipsel leitest Du den Tastendruck nach der Bearbeitung trotzdem an die Standardfenster-Prozedur weiter. In diesem Fall besser 0 zurückgeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1522522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1522522</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Wed, 04 Jun 2008 13:45:06 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Wed, 04 Jun 2008 17:55:04 GMT]]></title><description><![CDATA[<p>Schöne Idee, helfen tuts leider aber auch nicht ... <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>Eigentlich könnte die Frage auch so lauten:</p>
<p><strong>Wie ignoriert man Tasten in einem Edit-Window, so dass sie nicht geschrieben werden?</strong></p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1522698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1522698</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Wed, 04 Jun 2008 17:55:04 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Wed, 04 Jun 2008 19:08:43 GMT]]></title><description><![CDATA[<p>WM_CHAR</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1522765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1522765</guid><dc:creator><![CDATA[Dipl.Inf.Student]]></dc:creator><pubDate>Wed, 04 Jun 2008 19:08:43 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Thu, 05 Jun 2008 14:42:03 GMT]]></title><description><![CDATA[<p>Interessant, das funktioniert sogar schon fast:</p>
<pre><code class="language-cpp">if (msg == WM_CHAR &amp;&amp; wParam == VK_RETURN)
{
    return 1; //Zeilenumbruch verwerfen
}
</code></pre>
<p>Nun tippe ich Enter und es passiert nichts - sehr schön!<br />
Allerdings möchte das Ganze ja gern in Verbindung mit der Strg-Taste (VK_CONTROL) realisieren und das gestaltet sich noch schwierig.</p>
<pre><code class="language-cpp">if (msg == WM_CHAR &amp;&amp; wParam == VK_RETURN &amp;&amp; KEYDOWN(VK_CONTROL))
{
    return 1; //Zeilenumbruch verwerfen
}
</code></pre>
<p>Mein KEYDOWN()-Makro:</p>
<pre><code class="language-cpp">#define KEYDOWN(id) (BOOL)(GetAsyncKeyState(id)&amp;(1&lt;&lt;15))
</code></pre>
<p>Wenn ich nun Strg+Enter drücke, springt meine If-Anfrage nicht an.</p>
<p>Mit WM_KEYDOWN hat KEYDOWN() funktioniert.</p>
<p>Bitte um Hilfe.</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1522846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1522846</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Thu, 05 Jun 2008 14:42:03 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Thu, 05 Jun 2008 16:59:29 GMT]]></title><description><![CDATA[<p>Da muss es doch eine Lösung geben ... ?</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1523530</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1523530</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Thu, 05 Jun 2008 16:59:29 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Fri, 06 Jun 2008 08:01:45 GMT]]></title><description><![CDATA[<p>MaDsTyLe schrieb:</p>
<blockquote>
<p><strong>Wie ignoriert man Tasten in einem Edit-Window, so dass sie nicht geschrieben werden?</strong></p>
</blockquote>
<p>Verwende EN_UPDATE <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>Wie wärs mit ein bißchen Forumsuche? Z.B.:<br />
&quot;Editbox: nur Hexadeziamlzahlen&quot; <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-214527.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-214527.html</a><br />
Du mußt Dich erstmal für ein Konzept entscheiden: Entweder läßt Du nur solche Tastatur-Eingaben zu die zulässig sind oder filterst eben solche raus die unerwünscht sind.</p>
<p>Ein Riesenvorteil meiner Methode gegenüber Tastatur-Auswertungen á la WM_CHAR oder WM_KEYDOWN ist, daß sie auch bei Drag&amp;Drop oder Copy&amp;Paste (also keine Tastatureingaben!) funktionieren <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1523842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1523842</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Fri, 06 Jun 2008 08:01:45 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Fri, 06 Jun 2008 09:02:16 GMT]]></title><description><![CDATA[<p>MaDsTyLe schrieb:</p>
<blockquote>
<pre><code class="language-cpp">#define KEYDOWN(id) (BOOL)(GetAsyncKeyState(id)&amp;(1&lt;&lt;15))
</code></pre>
</blockquote>
<p>Das ist Unsinn, es muss GetKeyState verwendet werden.<br />
Unter schwerer Last würde GetAsynchKeyState bereits melden, das eine Taste nicht mehr gedrückt ist, obwohl sie zu der Zeit der erzeugtem WM_CHAR Nachricht gedrückt war.</p>
<p>Lies mal bitte:<br />
<a href="http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx</a><br />
<a href="http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx</a></p>
<p>Irgendwann hat irgendein Mensch angefangen einen Tipp mit GetAsynchKeyState zu geben und dieser Unsinn kursiert nun auf ewig durch die Netze...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1523896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1523896</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 06 Jun 2008 09:02:16 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Fri, 06 Jun 2008 11:22:44 GMT]]></title><description><![CDATA[<p>Danke, aber was bedeutet &quot;Unter schwerer Last&quot; konkret?</p>
<p>lg Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1523981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1523981</guid><dc:creator><![CDATA[MaDsTyLe]]></dc:creator><pubDate>Fri, 06 Jun 2008 11:22:44 GMT</pubDate></item><item><title><![CDATA[Reply to Mehrzeiliges Editfeld leeren on Sun, 08 Jun 2008 17:36:26 GMT]]></title><description><![CDATA[<p>Wenn Windows sehr stark unter Last steht (100 CPU Auslastung) kann man bei dem Bearbeiten von Tastaturbefehlen oft einen starken Nachlauf festestellen.<br />
D.h. man Tippt Tasten und es dauert Sekunden bis die Tasten einlaufen...<br />
In solchen Fällen würde GetAsnchKeyState versagen, oder zu wirklich ungewollten Funktionen führen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1525276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1525276</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Sun, 08 Jun 2008 17:36:26 GMT</pubDate></item></channel></rss>