<?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[Frage zu Child Windows.]]></title><description><![CDATA[<p>Hallo. Was ich versuche zu machen ist ein Dialog mit 2 Buttons zu erstellen, was auch funktioniert. Jedoch möchte ich jetzt wenn ich eins von den Buttons drücke, dass es ein Child window anzeigt sowas wie tabs halt, dass problem bei der sache ist das es Immer fehlschlägt den IDD_DIALOG2 zu erstellen, es funktioniert mit Popup window prima, aber keine lust darauf, will halt das beide als Child angezeigt werden. Ich hoffe das mir jemand helfen kann, danke schon mal.</p>
<pre><code class="language-cpp">#ifndef _INC_STDIO
	#include &lt;stdio.h&gt;
#endif

#ifndef _STRING_
	#include &lt;string&gt;
#endif

#ifndef _WINDOWS_
	#define _WIN32_WINNT 0x0502
	#include &lt;windows.h&gt;
#endif

#include &quot;resource.h&quot;

HWND gHwnd = 0;
DWORD threadId = 0;
DWORD opThread = 0;
HANDLE hThread = 0;
HANDLE hOption = 0;
HINSTANCE MAIN;
HWND Option = 0;
HWND checkHwnd = 0;
INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProc1(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

//-----------------------------------------------------------------------------------------------------------------------------------------

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

	MAIN = hInstance;
	HWND hwnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc, (LPARAM)hInstance);
	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		if(!IsDialogMessage(hwnd, &amp;Msg))
		{
			TranslateMessage(&amp;Msg);
			DispatchMessage(&amp;Msg);
		}
	}

	// Standard return
	return 0;
}

DWORD WINAPI OptionsDialog(LPVOID lParam)
{

	gHwnd = CreateDialog(MAIN, MAKEINTRESOURCE(IDD_DIALOG2), NULL, DlgProc1);
	if(gHwnd == NULL)
	{
		MessageBox(NULL, &quot;Window creation failed!&quot;, &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		TranslateMessage(&amp;Msg);
		DispatchMessage(&amp;Msg);
	}

	return 0;
}

DWORD WINAPI CheckDialog(LPVOID lParam)
{

	checkHwnd = CreateDialog(MAIN, MAKEINTRESOURCE(IDD_DIALOG3), NULL, DlgProc2);
	if(gHwnd == NULL)
	{
		MessageBox(NULL, &quot;Window creation failed!&quot;, &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		TranslateMessage(&amp;Msg);
		DispatchMessage(&amp;Msg);
	}

	return 0;
}

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg) 
    {

		case WM_INITDIALOG:
        {
			hThread = CreateThread(0, 0, OptionsDialog, 0, 0, &amp;threadId);
			hOption = CreateThread(0, 0, CheckDialog, 0, 0,   &amp;opThread);

		} break;

		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {
				// Exit
				case IDCANCEL:
				{
					PostQuitMessage(0);
					TerminateThread(hThread, 0);
					TerminateThread(hOption, 0);

				}break;
				case btnTest:
					{
						if(IsWindowVisible(checkHwnd))
						{
							ShowWindow(checkHwnd,  false);	
							ShowWindow(Option,  true);
						}
						else
						{
							ShowWindow(Option,  true);

						}

						break;
					}
				case btnTest2:
					{
						if(IsWindowVisible(Option))
						{
							ShowWindow(Option,     false);
							ShowWindow(checkHwnd,  true);
						}
						else
						{
							ShowWindow(checkHwnd,  true);

						}

						break;
					}

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
INT_PTR CALLBACK DlgProc1(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	// Handle the message
	switch(uMsg) 
    {
		// Dialog initialize
		case WM_INITDIALOG:
        {
			Option = hWnd;

		} break;

		// Commands
		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
INT_PTR CALLBACK DlgProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	// Handle the message
	switch(uMsg) 
    {
		// Dialog initialize
		case WM_INITDIALOG:
        {
			checkHwnd = hWnd;

		} break;

		// Commands
		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/229999/frage-zu-child-windows</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 02:48:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/229999.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Dec 2008 08:09:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage zu Child Windows. on Fri, 19 Dec 2008 08:09:35 GMT]]></title><description><![CDATA[<p>Hallo. Was ich versuche zu machen ist ein Dialog mit 2 Buttons zu erstellen, was auch funktioniert. Jedoch möchte ich jetzt wenn ich eins von den Buttons drücke, dass es ein Child window anzeigt sowas wie tabs halt, dass problem bei der sache ist das es Immer fehlschlägt den IDD_DIALOG2 zu erstellen, es funktioniert mit Popup window prima, aber keine lust darauf, will halt das beide als Child angezeigt werden. Ich hoffe das mir jemand helfen kann, danke schon mal.</p>
<pre><code class="language-cpp">#ifndef _INC_STDIO
	#include &lt;stdio.h&gt;
#endif

#ifndef _STRING_
	#include &lt;string&gt;
#endif

#ifndef _WINDOWS_
	#define _WIN32_WINNT 0x0502
	#include &lt;windows.h&gt;
#endif

#include &quot;resource.h&quot;

HWND gHwnd = 0;
DWORD threadId = 0;
DWORD opThread = 0;
HANDLE hThread = 0;
HANDLE hOption = 0;
HINSTANCE MAIN;
HWND Option = 0;
HWND checkHwnd = 0;
INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProc1(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

//-----------------------------------------------------------------------------------------------------------------------------------------

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

	MAIN = hInstance;
	HWND hwnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc, (LPARAM)hInstance);
	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		if(!IsDialogMessage(hwnd, &amp;Msg))
		{
			TranslateMessage(&amp;Msg);
			DispatchMessage(&amp;Msg);
		}
	}

	// Standard return
	return 0;
}

DWORD WINAPI OptionsDialog(LPVOID lParam)
{

	gHwnd = CreateDialog(MAIN, MAKEINTRESOURCE(IDD_DIALOG2), NULL, DlgProc1);
	if(gHwnd == NULL)
	{
		MessageBox(NULL, &quot;Window creation failed!&quot;, &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		TranslateMessage(&amp;Msg);
		DispatchMessage(&amp;Msg);
	}

	return 0;
}

DWORD WINAPI CheckDialog(LPVOID lParam)
{

	checkHwnd = CreateDialog(MAIN, MAKEINTRESOURCE(IDD_DIALOG3), NULL, DlgProc2);
	if(gHwnd == NULL)
	{
		MessageBox(NULL, &quot;Window creation failed!&quot;, &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		TranslateMessage(&amp;Msg);
		DispatchMessage(&amp;Msg);
	}

	return 0;
}

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg) 
    {

		case WM_INITDIALOG:
        {
			hThread = CreateThread(0, 0, OptionsDialog, 0, 0, &amp;threadId);
			hOption = CreateThread(0, 0, CheckDialog, 0, 0,   &amp;opThread);

		} break;

		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {
				// Exit
				case IDCANCEL:
				{
					PostQuitMessage(0);
					TerminateThread(hThread, 0);
					TerminateThread(hOption, 0);

				}break;
				case btnTest:
					{
						if(IsWindowVisible(checkHwnd))
						{
							ShowWindow(checkHwnd,  false);	
							ShowWindow(Option,  true);
						}
						else
						{
							ShowWindow(Option,  true);

						}

						break;
					}
				case btnTest2:
					{
						if(IsWindowVisible(Option))
						{
							ShowWindow(Option,     false);
							ShowWindow(checkHwnd,  true);
						}
						else
						{
							ShowWindow(checkHwnd,  true);

						}

						break;
					}

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
INT_PTR CALLBACK DlgProc1(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	// Handle the message
	switch(uMsg) 
    {
		// Dialog initialize
		case WM_INITDIALOG:
        {
			Option = hWnd;

		} break;

		// Commands
		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
INT_PTR CALLBACK DlgProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	// Handle the message
	switch(uMsg) 
    {
		// Dialog initialize
		case WM_INITDIALOG:
        {
			checkHwnd = hWnd;

		} break;

		// Commands
		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1632726</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1632726</guid><dc:creator><![CDATA[@_@]]></dc:creator><pubDate>Fri, 19 Dec 2008 08:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Child Windows. on Fri, 19 Dec 2008 08:11:56 GMT]]></title><description><![CDATA[<p>Mit beide meinte ich IDD_DIALOG2 &amp; IDD_DIALOG3, dass sollen die Dialogs für die Child windows werden, grüße.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1632728</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1632728</guid><dc:creator><![CDATA[@_@]]></dc:creator><pubDate>Fri, 19 Dec 2008 08:11:56 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Child Windows. on Fri, 19 Dec 2008 10:12:33 GMT]]></title><description><![CDATA[<p>Dann Erzeuge Fenster und keine neuen Threads!</p>
<p>Wie kommst Du darauf, dass Du mit CreateThread/TerminateThread arbeiten musst.<br />
Benutzte direkt CreateDialog, achte darauf das die Tmeplates den Stil WS_CHILD haben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1632769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1632769</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 19 Dec 2008 10:12:33 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Child Windows. on Fri, 19 Dec 2008 11:16:02 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Dann Erzeuge Fenster und keine neuen Threads!</p>
<p>Wie kommst Du darauf, dass Du mit CreateThread/TerminateThread arbeiten musst.<br />
Benutzte direkt CreateDialog, achte darauf das die Tmeplates den Stil WS_CHILD haben.</p>
</blockquote>
<p>Die Threads erzeugen ja Fenster, von daher :P. Habs aber entfernt und so probiert, aber der fehler kommt immernoch. Hier siehts bei mir so aus, ich glaub nicht das ich was vergessen habe..</p>
<p><a href="http://i44.tinypic.com/ogyq34.jpg" rel="nofollow">http://i44.tinypic.com/ogyq34.jpg</a> IDD_DIALOG1 -&gt; Main Dialog.<br />
<a href="http://i44.tinypic.com/ogyq34.jpg" rel="nofollow">http://i44.tinypic.com/ogyq34.jpg</a> IDD_DIALOG3 -&gt; Child dialog. IDD_DIALOG2 Ist gleich.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

HWND gHwnd = 0;
HINSTANCE MAIN;
HWND Option = 0;
HWND checkHwnd = 0;
INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProc1(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

//-----------------------------------------------------------------------------------------------------------------------------------------

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

	MAIN = hInstance;
	HWND hwnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc, (LPARAM)hInstance);
	MSG Msg = {0};
	while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
	{
		if(!IsDialogMessage(hwnd, &amp;Msg))
		{
			TranslateMessage(&amp;Msg);
			DispatchMessage(&amp;Msg);
		}
	}

	// Standard return
	return 0;
}

INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch(uMsg) 
    {

		case WM_INITDIALOG:
        {

			gHwnd = CreateDialog(MAIN, MAKEINTRESOURCE(IDD_DIALOG2), NULL, DlgProc1);
			if(gHwnd == NULL)
	        {
		        MessageBox(NULL, &quot;Window creation failed!&quot;, &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK);
		        return 0;
	        }

			checkHwnd = CreateDialog(MAIN, MAKEINTRESOURCE(IDD_DIALOG3), NULL, DlgProc2);
		    if(checkHwnd == NULL)
	        {
		        MessageBox(NULL, &quot;Window creation failed!&quot;, &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK);
		        return 0;
	        }

		} break;

		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {
				// Exit
				case IDCANCEL:
				{
					PostQuitMessage(0);

				}break;
				case btnTest:
					{
						if(IsWindowVisible(checkHwnd))
						{
							ShowWindow(checkHwnd,  false);	
							ShowWindow(Option,  true);
						}
						else
						{
							ShowWindow(Option,  true);

						}

						break;
					}
				case btnTest2:
					{
						if(IsWindowVisible(Option))
						{
							ShowWindow(Option,     false);
							ShowWindow(checkHwnd,  true);
						}
						else
						{
							ShowWindow(checkHwnd,  true);

						}

						break;
					}

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
INT_PTR CALLBACK DlgProc1(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	// Handle the message
	switch(uMsg) 
    {
		// Dialog initialize
		case WM_INITDIALOG:
        {
			Option = hWnd;

		} break;

		// Commands
		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
INT_PTR CALLBACK DlgProc2(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	// Handle the message
	switch(uMsg) 
    {
		// Dialog initialize
		case WM_INITDIALOG:
        {
			checkHwnd = hWnd;

		} break;

		// Commands
		case WM_COMMAND:
        {
			int button = LOWORD(wParam);
            switch (button)
            {

			}
		} break;

		default:
		{
			// Message not handled
			return FALSE;
		}
	}

	// Message handled
	return TRUE;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1632790</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1632790</guid><dc:creator><![CDATA[@_@]]></dc:creator><pubDate>Fri, 19 Dec 2008 11:16:02 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zu Child Windows. on Fri, 19 Dec 2008 11:17:42 GMT]]></title><description><![CDATA[<p>Oops. Bild vom IDD_DIALOG1 -&gt; <a href="http://i40.tinypic.com/20r5ide.jpg" rel="nofollow">http://i40.tinypic.com/20r5ide.jpg</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1632792</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1632792</guid><dc:creator><![CDATA[@_@]]></dc:creator><pubDate>Fri, 19 Dec 2008 11:17:42 GMT</pubDate></item></channel></rss>