<?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[Noobfrage: Editfeld - Fenster schließt sich beim klick]]></title><description><![CDATA[<p>Hallöchen.</p>
<p>Ich habe letzte Woche mal ein bisschen mit WinAPI angefangen und da ich leider nur ein relativ gutes Tutorial gefunden habe muss ich hier leider meine noobigen Fragen loswerden.</p>
<p>Ich habe (im DevC++) eine Editbox erstellt. Nach dem kompilieren ist die auch da, so wie ich das haben wollte. Allerdings schließt sich das Fenster, sobald ich da draufklicke um was einzugeben. ICh zeig euch hier einfach mal meinen Code:</p>
<pre><code class="language-cpp">LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, 
                                  WPARAM wParam, LPARAM lParam)
{
    char *buffer = NULL;
    HWND hButtonEnd;
    HWND hEditN;

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
            hButtonEnd = CreateWindow( &quot;button&quot;,
                                       &quot;Beenden&quot;,
                                       WS_CHILD | WS_VISIBLE,
                                       20, 500, 360, 30,
                                       hwnd,
                                       NULL,
                                       ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                       NULL);
            hEditN = CreateWindowEx (WS_EX_CLIENTEDGE,
                                     &quot;EDIT&quot;,
                                     buffer,
                                     WS_CHILD | WS_VISIBLE,
                                     20, 50, 100, 25,
                                     hwnd,
                                     NULL,
                                     ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                     NULL);
            free(buffer);

            return 0;
        case WM_SIZE:
            MoveWindow(hButtonEnd, LOWORD(lParam) / 2 - 80, HIWORD(lParam) - 30,
                        160, 22, TRUE);
            MoveWindow(hEditN, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
            return 0;
        case WM_COMMAND:
            if (lParam == (LPARAM)hButtonEnd)
            {
                if (HIWORD(wParam) == BN_CLICKED) 
                    SendMessage(hwnd, WM_CLOSE, 0, 0);
            };    
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;                
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    };

    return 0;
};
</code></pre>
<p>Die Winmain-Funktion brauch ich denk ich mal nicht mitschicken. Die ist sowieso standard.</p>
<p>Schonmal Danke im Vorraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/147123/noobfrage-editfeld-fenster-schließt-sich-beim-klick</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 18:27:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147123.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 May 2006 10:03:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 10:03:41 GMT]]></title><description><![CDATA[<p>Hallöchen.</p>
<p>Ich habe letzte Woche mal ein bisschen mit WinAPI angefangen und da ich leider nur ein relativ gutes Tutorial gefunden habe muss ich hier leider meine noobigen Fragen loswerden.</p>
<p>Ich habe (im DevC++) eine Editbox erstellt. Nach dem kompilieren ist die auch da, so wie ich das haben wollte. Allerdings schließt sich das Fenster, sobald ich da draufklicke um was einzugeben. ICh zeig euch hier einfach mal meinen Code:</p>
<pre><code class="language-cpp">LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, 
                                  WPARAM wParam, LPARAM lParam)
{
    char *buffer = NULL;
    HWND hButtonEnd;
    HWND hEditN;

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
            hButtonEnd = CreateWindow( &quot;button&quot;,
                                       &quot;Beenden&quot;,
                                       WS_CHILD | WS_VISIBLE,
                                       20, 500, 360, 30,
                                       hwnd,
                                       NULL,
                                       ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                       NULL);
            hEditN = CreateWindowEx (WS_EX_CLIENTEDGE,
                                     &quot;EDIT&quot;,
                                     buffer,
                                     WS_CHILD | WS_VISIBLE,
                                     20, 50, 100, 25,
                                     hwnd,
                                     NULL,
                                     ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                     NULL);
            free(buffer);

            return 0;
        case WM_SIZE:
            MoveWindow(hButtonEnd, LOWORD(lParam) / 2 - 80, HIWORD(lParam) - 30,
                        160, 22, TRUE);
            MoveWindow(hEditN, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
            return 0;
        case WM_COMMAND:
            if (lParam == (LPARAM)hButtonEnd)
            {
                if (HIWORD(wParam) == BN_CLICKED) 
                    SendMessage(hwnd, WM_CLOSE, 0, 0);
            };    
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;                
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    };

    return 0;
};
</code></pre>
<p>Die Winmain-Funktion brauch ich denk ich mal nicht mitschicken. Die ist sowieso standard.</p>
<p>Schonmal Danke im Vorraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057451</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057451</guid><dc:creator><![CDATA[Max3000]]></dc:creator><pubDate>Sun, 14 May 2006 10:03:41 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 10:58:57 GMT]]></title><description><![CDATA[<p>Ich schenk dir ein</p>
<pre><code class="language-cpp">break;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1057485</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057485</guid><dc:creator><![CDATA[cin]]></dc:creator><pubDate>Sun, 14 May 2006 10:58:57 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 12:18:38 GMT]]></title><description><![CDATA[<p>Hab jetzt mit break wirklich alles ausprobiert, aber es klappt immer noch nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057522</guid><dc:creator><![CDATA[Max3000]]></dc:creator><pubDate>Sun, 14 May 2006 12:18:38 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 12:31:16 GMT]]></title><description><![CDATA[<p>nach der if klammer des</p>
<pre><code>;
</code></pre>
<p>weg und n</p>
<pre><code class="language-cpp">break;
</code></pre>
<p>hin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057529</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057529</guid><dc:creator><![CDATA[b0m0x]]></dc:creator><pubDate>Sun, 14 May 2006 12:31:16 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 13:40:03 GMT]]></title><description><![CDATA[<p>Gehtg irgendwie auch nicht.<br />
Das Problem ist ja, dass ich einen Beenden-Button habe und wenn ich auf den klicke soll sich das fenster schließen.<br />
Aber das macht es auch, wenn ich auf die Textbox klicke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057561</guid><dc:creator><![CDATA[Max3000]]></dc:creator><pubDate>Sun, 14 May 2006 13:40:03 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 13:46:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">case WM_COMMAND:
            if (lParam == (LPARAM)hButtonEnd)
            {
                if (HIWORD(wParam) == BN_CLICKED)
                    SendMessage(hwnd, WM_CLOSE, 0, 0);
            };
        break; // &lt;------
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1057565</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057565</guid><dc:creator><![CDATA[dumm?]]></dc:creator><pubDate>Sun, 14 May 2006 13:46:00 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 13:46:28 GMT]]></title><description><![CDATA[<p>Die Lösung zu deinem Problem wurde schon geposted.</p>
<p>Und</p>
<pre><code class="language-cpp">HWND hButtonEnd;
    HWND hEditN;
</code></pre>
<p>solltest du entweder global oder static machen, sonst wird dein WM_SIZE und WM_COMMAND code auch nicht funktionieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057566</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057566</guid><dc:creator><![CDATA[WebNubbi]]></dc:creator><pubDate>Sun, 14 May 2006 13:46:28 GMT</pubDate></item><item><title><![CDATA[Reply to Noobfrage: Editfeld - Fenster schließt sich beim klick on Sun, 14 May 2006 14:28:57 GMT]]></title><description><![CDATA[<p>Vielen Dank.<br />
Jetzt klappts. Und verzeiht mir meine simple Frage.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1057590</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1057590</guid><dc:creator><![CDATA[Max3000]]></dc:creator><pubDate>Sun, 14 May 2006 14:28:57 GMT</pubDate></item></channel></rss>