<?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[Messagehandling in Childwindows eines Fensters]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wenn ich ein Fenster habe und darauf ein Button erstelle, dann sendet Windows ja beim Klicken des Buttons an das Fenster eine Nachricht. Dies klappt leider aber nicht wenn ich ein Childwindow in dem Hauptfenster erstelle und dann in diesem Fenster in Button erstelle, also es wird an das Hauptfenster keine Nachricht gesand, sondern wahrscheinlich an das Childwindow, also das Parantwindow vom Button. Wie kann ich diese Nachricht &quot;abfangen&quot; und bearbeiten?</p>
<p>Gruss</p>
<p>Max Mütze</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/116894/messagehandling-in-childwindows-eines-fensters</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Jul 2026 14:41:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/116894.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 01 Aug 2005 10:15:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Mon, 01 Aug 2005 10:15:14 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wenn ich ein Fenster habe und darauf ein Button erstelle, dann sendet Windows ja beim Klicken des Buttons an das Fenster eine Nachricht. Dies klappt leider aber nicht wenn ich ein Childwindow in dem Hauptfenster erstelle und dann in diesem Fenster in Button erstelle, also es wird an das Hauptfenster keine Nachricht gesand, sondern wahrscheinlich an das Childwindow, also das Parantwindow vom Button. Wie kann ich diese Nachricht &quot;abfangen&quot; und bearbeiten?</p>
<p>Gruss</p>
<p>Max Mütze</p>
]]></description><link>https://www.c-plusplus.net/forum/post/843306</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843306</guid><dc:creator><![CDATA[Max Mütze]]></dc:creator><pubDate>Mon, 01 Aug 2005 10:15:14 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Mon, 01 Aug 2005 10:23:52 GMT]]></title><description><![CDATA[<p>Max Mütze schrieb:</p>
<blockquote>
<p>Wie kann ich diese Nachricht &quot;abfangen&quot; und bearbeiten?</p>
</blockquote>
<p>Ganz normal, nur eben im deinem Child-Window (also dem Parent des Buttons) <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/843317</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843317</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 01 Aug 2005 10:23:52 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Mon, 01 Aug 2005 10:40:51 GMT]]></title><description><![CDATA[<p>Hmm... ich meine mit dem Child-Window kein eigenes Dialogfenster sondern nur eines in einem Dialgfenster (dem Hauptfenster).<br />
Wie kann man denn einem Childwindow einen Message Processor zuordnen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/843335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843335</guid><dc:creator><![CDATA[Max Mütze]]></dc:creator><pubDate>Mon, 01 Aug 2005 10:40:51 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Mon, 01 Aug 2005 11:25:29 GMT]]></title><description><![CDATA[<p>Jedes Fenster hat eine MessageProc - was für ein Child hast du denn erstellt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/843369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843369</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 01 Aug 2005 11:25:29 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Mon, 01 Aug 2005 13:19:10 GMT]]></title><description><![CDATA[<p>Wie bereits gesagt ist es KEIN dialogfenster, das man umherschieben kann, sondern ist es selber ein control, in diesem Fall ein static-text-control.</p>
<pre><code class="language-cpp">hChildWnd = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT(&quot;Static&quot;), NULL, WS_CHILD | SS_BLACKRECT | WS_VISIBLE, 50, 50, 200, 200, hWnd, NULL, hInst, NULL);
</code></pre>
<p>Wie kann man so einem Fenster einem Msg-Processor zuordnen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/843510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843510</guid><dc:creator><![CDATA[Max Mütze]]></dc:creator><pubDate>Mon, 01 Aug 2005 13:19:10 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Mon, 01 Aug 2005 13:40:11 GMT]]></title><description><![CDATA[<p>Subclassing - du kannst aber auch einfach gleich eine eigene Fensterklasse machen, je nach dem, was mit weniger Aufwand verbunden ist <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/843542</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843542</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Mon, 01 Aug 2005 13:40:11 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Tue, 02 Aug 2005 07:01:55 GMT]]></title><description><![CDATA[<p>Gut das mit dem Subclassing funktioniert ganz gut, nur ist jetzt das Probem, das ic den Button leider nicht sehen kann, wenn das Programm startet. Erst wenn ich das Fenster bewege wird dieser sichtbar. Woran könnte das denn liegen und wie stellt man das ab?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/843979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/843979</guid><dc:creator><![CDATA[Max Mütze]]></dc:creator><pubDate>Tue, 02 Aug 2005 07:01:55 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Tue, 02 Aug 2005 07:55:35 GMT]]></title><description><![CDATA[<p>Vielleicht hilft ein WS_CLIPCHILDREN beim Static?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/844031</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/844031</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Tue, 02 Aug 2005 07:55:35 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Tue, 02 Aug 2005 12:33:16 GMT]]></title><description><![CDATA[<p>Nein das hilft leider nicht weiter. Hier ist der code, den ich jetzt benutze.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

#define IDC_EXIT 3001

BOOL CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK SubProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInst,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
				   int nCmdShow)
{

	MSG		msg;
	HWND	hWnd, hInnerWnd; 

	// show dialog
	hWnd = CreateDialog(NULL, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc);
	ShowWindow(hWnd, SW_SHOW);

	// inner child (static)
	hInnerWnd = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT(&quot;Static&quot;), NULL, WS_CHILD | SS_BLACKRECT | WS_VISIBLE | WS_CLIPCHILDREN, 50, 50, 200, 200,
							   hWnd, NULL, hInst, NULL);

	// Button
	CreateWindow(&quot;BUTTON&quot;, &quot;Exit&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10, 10, 50, 20, hInnerWnd, (HMENU)IDC_EXIT, hInst, NULL);

	SetWindowLong(hInnerWnd, GWL_WNDPROC, (LONG) SubProc);

	ShowWindow(hWnd, SW_SHOW);	
	ShowWindow(hInnerWnd, SW_SHOW);

	while(GetMessage(&amp;msg, NULL, 0, 0))
	{
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}

	return 0;
}

BOOL CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_CLOSE:
        PostQuitMessage(0);
        return true;
    }

	return false;
}

BOOL CALLBACK SubProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_COMMAND:
	{
		switch(LOWORD(wParam))
		{
		 case IDC_EXIT:
			PostQuitMessage(0);
			return true;
		}break;
	} break;
	}

	return false;
}
</code></pre>
<p>Fällt dir (oder jemand anders) was falsches daran auf?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/844379</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/844379</guid><dc:creator><![CDATA[Max Mütze]]></dc:creator><pubDate>Tue, 02 Aug 2005 12:33:16 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Tue, 02 Aug 2005 12:37:59 GMT]]></title><description><![CDATA[<p>du speicherst gar nicht den rückgabewert von SetWindowLong, bzw. rufst nicht GetWindowLong auf...man muss später wieder die original wndproc aufrufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/844383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/844383</guid><dc:creator><![CDATA[fehler...]]></dc:creator><pubDate>Tue, 02 Aug 2005 12:37:59 GMT</pubDate></item><item><title><![CDATA[Reply to Messagehandling in Childwindows eines Fensters on Wed, 03 Aug 2005 12:54:05 GMT]]></title><description><![CDATA[<p>Jo stimmt daran hats gelegen.<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/844978</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/844978</guid><dc:creator><![CDATA[Max Mütze]]></dc:creator><pubDate>Wed, 03 Aug 2005 12:54:05 GMT</pubDate></item></channel></rss>