<?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[Problem mit Child-Fenster]]></title><description><![CDATA[<p>Ich hab eien Fenster mit mehreren Groupboxen und Radiobuttons drinnen. Mein Problem ist nun das ich die Windows-Messages von den Radiobuttons nicht abfangen kann. Hier mal die Funktion welche für die Nachrichten zuständig ist:</p>
<pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HWND  hParent;
    int   iGroupID;
    char* lpszClassName;

    switch (message)
    {
    case WM_CREATE:
        iGroupID = -1;
        for (int count = 0; count &lt; NUM_BUTTONS; count++)
        {
            if (iGroupID == -1 || Buttons[count].iStyle == BS_GROUPBOX)
            {
                iGroupID = count;
                hParent = hWnd;
             }
             else
             {
                hParent = Buttons[iGroupID].hOwn;
             }

             Buttons[count].hOwn = CreateWindow(  &quot;button&quot;,
                                                  Buttons[count].szText,
                                                  WS_CHILD | WS_VISIBLE | Buttons[count].iStyle,
                                                  Buttons[count].iLeft,
                                                  Buttons[count].iTop,
                                                  Buttons[count].iWidth,
                                                  Buttons[count].iHeight,
                                                  hParent,
                                                  NULL,
                                                  ((LPCREATESTRUCT) lParam)-&gt;hInstance,
                                                  NULL);
         }
         UpdateWindow(hWnd);
         return 0;
    case WM_COMMAND:
         iGroupID = 0;
         for (int count = 0; count &lt; NUM_BUTTONS; count++)
         {
            if (lParam == (LPARAM)Buttons[count].hOwn &amp;&amp; HIWORD(wParam) == BN_CLICKED)
            {
               if(Buttons[count].iStyle == BS_GROUPBOX)
                  iGroupID = count;
               else if (Buttons[count].iStyle == BS_AUTORADIOBUTTON)
                  Buttons[iGroupID].dwValue = Buttons[count].dwValue;
               else if (Buttons[count].iStyle == BS_PUSHBUTTON)
                  Shutdown(hWnd);
            }
         }
         return 0;
    case WM_DESTROY:
         PostQuitMessage(0);
         return 0;
    }

return DefWindowProc(hWnd, message, wParam, lParam);
}
</code></pre>
<p>Hat da von euch jemand eine Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/120609/problem-mit-child-fenster</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 11:00:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/120609.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Sep 2005 18:39:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Child-Fenster on Wed, 14 Sep 2005 18:39:19 GMT]]></title><description><![CDATA[<p>Ich hab eien Fenster mit mehreren Groupboxen und Radiobuttons drinnen. Mein Problem ist nun das ich die Windows-Messages von den Radiobuttons nicht abfangen kann. Hier mal die Funktion welche für die Nachrichten zuständig ist:</p>
<pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HWND  hParent;
    int   iGroupID;
    char* lpszClassName;

    switch (message)
    {
    case WM_CREATE:
        iGroupID = -1;
        for (int count = 0; count &lt; NUM_BUTTONS; count++)
        {
            if (iGroupID == -1 || Buttons[count].iStyle == BS_GROUPBOX)
            {
                iGroupID = count;
                hParent = hWnd;
             }
             else
             {
                hParent = Buttons[iGroupID].hOwn;
             }

             Buttons[count].hOwn = CreateWindow(  &quot;button&quot;,
                                                  Buttons[count].szText,
                                                  WS_CHILD | WS_VISIBLE | Buttons[count].iStyle,
                                                  Buttons[count].iLeft,
                                                  Buttons[count].iTop,
                                                  Buttons[count].iWidth,
                                                  Buttons[count].iHeight,
                                                  hParent,
                                                  NULL,
                                                  ((LPCREATESTRUCT) lParam)-&gt;hInstance,
                                                  NULL);
         }
         UpdateWindow(hWnd);
         return 0;
    case WM_COMMAND:
         iGroupID = 0;
         for (int count = 0; count &lt; NUM_BUTTONS; count++)
         {
            if (lParam == (LPARAM)Buttons[count].hOwn &amp;&amp; HIWORD(wParam) == BN_CLICKED)
            {
               if(Buttons[count].iStyle == BS_GROUPBOX)
                  iGroupID = count;
               else if (Buttons[count].iStyle == BS_AUTORADIOBUTTON)
                  Buttons[iGroupID].dwValue = Buttons[count].dwValue;
               else if (Buttons[count].iStyle == BS_PUSHBUTTON)
                  Shutdown(hWnd);
            }
         }
         return 0;
    case WM_DESTROY:
         PostQuitMessage(0);
         return 0;
    }

return DefWindowProc(hWnd, message, wParam, lParam);
}
</code></pre>
<p>Hat da von euch jemand eine Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872272</guid><dc:creator><![CDATA[DarkMight1]]></dc:creator><pubDate>Wed, 14 Sep 2005 18:39:19 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Wed, 14 Sep 2005 19:22:30 GMT]]></title><description><![CDATA[<p>so wie das lese sind die radios auch childs von den groups. wie soll das gehen?<br />
[edit]<br />
sollten diese nicht childs von hwnd und das erste noch zusätzlich den style WS_GROUP besitzen. täusche ich mich gerade?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872295</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 14 Sep 2005 19:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Wed, 14 Sep 2005 20:26:11 GMT]]></title><description><![CDATA[<p>Wenn ich alle Radiobuttons Childs von HWND mache habe ich eine große Gruppe mit Radiobuttons, ich brauche aber mehrere kleine Gruppen. Ich poste mal das Array mit den &quot;Buttons&quot;. Vieleicht wird dann einiges klarer.</p>
<pre><code>typedef struct BUTTONGROUP
{
     int     iStyle ;
     char *  szText ;
     HWND    hOwn   ;
     int     iTop   ;
     int     iLeft  ;
     int     iWidth ;
     int     iHeight;
     DWORD   dwValue;
};

BUTTONGROUP Buttons[] =
{
     BS_PUSHBUTTON,      &quot;Ausführen&quot;,              NULL, 410, 15,  190, 30,  0x00000000,

     BS_GROUPBOX,        &quot;SHTDN_REASON_MAJOR&quot;,     NULL, 10,  10,  200, 150, 0x00000000,
     BS_AUTORADIOBUTTON, &quot;_APPLICATION&quot;,           NULL, 20,  10,  180, 15,  0x00040000,
     BS_AUTORADIOBUTTON, &quot;_HARDWARE&quot;,              NULL, 35,  10,  180, 15,  0x00010000,
     BS_AUTORADIOBUTTON, &quot;_LEGACY_API&quot;,            NULL, 50,  10,  180, 15,  0x00070000,
     BS_AUTORADIOBUTTON, &quot;_OPERATINGSYSTEM&quot;,       NULL, 65,  10,  180, 15,  0x00020000,
     BS_AUTORADIOBUTTON, &quot;_OTHER&quot;,                 NULL, 80,  10,  180, 15,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;_POWER&quot;,                 NULL, 95,  10,  180, 15,  0x00060000,
     BS_AUTORADIOBUTTON, &quot;_SOFTWARE&quot;,              NULL, 110, 10,  180, 15,  0x00030000,
     BS_AUTORADIOBUTTON, &quot;_SYSTEM&quot;,                NULL, 125, 10,  180, 15,  0x00050000,

     BS_GROUPBOX,        &quot;SHTDN_REASON_MINOR&quot;,     NULL, 10,  210, 230, 435, 0x00000000,
     BS_AUTORADIOBUTTON, &quot;_BLUSCREEN&quot;,             NULL, 20,  10,  210, 15,  0x0000000F,
     BS_AUTORADIOBUTTON, &quot;_CORDUNPLUGGED&quot;,         NULL, 35,  10,  210, 15,  0x0000000B,
     BS_AUTORADIOBUTTON, &quot;_DISK&quot;,                  NULL, 50,  10,  210, 15,  0x00000007,
     BS_AUTORADIOBUTTON, &quot;_ENVIROMENT&quot;,            NULL, 65,  10,  210, 15,  0x0000000C,
     BS_AUTORADIOBUTTON, &quot;_HARDWARE_DRIVER&quot;,       NULL, 80,  10,  210, 15,  0x0000000D,
     BS_AUTORADIOBUTTON, &quot;_HOTFIX&quot;,                NULL, 95,  10,  210, 15,  0x00000011,
     BS_AUTORADIOBUTTON, &quot;_HOTFIX_UNINSTALL&quot;,      NULL, 110, 10,  210, 15,  0x00000017,
     BS_AUTORADIOBUTTON, &quot;_HUNG&quot;,                  NULL, 125, 10,  210, 15,  0x00000005,
     BS_AUTORADIOBUTTON, &quot;_INSTALLATION&quot;,          NULL, 140, 10,  210, 15,  0x00000002,
     BS_AUTORADIOBUTTON, &quot;_MAINTENANCE&quot;,           NULL, 155, 10,  210, 15,  0x00000001,
     BS_AUTORADIOBUTTON, &quot;_MMC&quot;,                   NULL, 170, 10,  210, 15,  0x00000019,
     BS_AUTORADIOBUTTON, &quot;_NETWORK_CONNECTIVITY&quot;,  NULL, 185, 10,  210, 15,  0x00000014,
     BS_AUTORADIOBUTTON, &quot;_NETWORKCARD&quot;,           NULL, 200, 10,  210, 15,  0x00000009,
     BS_AUTORADIOBUTTON, &quot;_OTHER&quot;,                 NULL, 215, 10,  210, 15,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;_OTHERDRIVER &quot;,          NULL, 230, 10,  210, 15,  0x0000000E,
     BS_AUTORADIOBUTTON, &quot;_POWER_SUPPLY&quot;,          NULL, 245, 10,  210, 15,  0x0000000A,
     BS_AUTORADIOBUTTON, &quot;_PROCESSOR&quot;,             NULL, 260, 10,  210, 15,  0x00000008,
     BS_AUTORADIOBUTTON, &quot;_RECONFIG&quot;,              NULL, 275, 10,  210, 15,  0x00000004,
     BS_AUTORADIOBUTTON, &quot;_SECURITY&quot;,              NULL, 290, 10,  210, 15,  0x00000013,
     BS_AUTORADIOBUTTON, &quot;_SECURITYFIX&quot;,           NULL, 305, 10,  210, 15,  0x00000012,
     BS_AUTORADIOBUTTON, &quot;_SECURITYFIX_UNINSTALL&quot;, NULL, 320, 10,  210, 15,  0x00000018,
     BS_AUTORADIOBUTTON, &quot;_SERVICEPACK&quot;,           NULL, 335, 10,  210, 15,  0x00000010,
     BS_AUTORADIOBUTTON, &quot;_SERVICEPACK_UNINSTALL&quot;, NULL, 350, 10,  210, 15,  0x00000016,
     BS_AUTORADIOBUTTON, &quot;_TERMSRV&quot;,               NULL, 365, 10,  210, 15,  0x00000020,
     BS_AUTORADIOBUTTON, &quot;_UNSTABLE&quot;,              NULL, 380, 10,  210, 15,  0x00000006,
     BS_AUTORADIOBUTTON, &quot;_UPGRADE&quot;,               NULL, 395, 10,  210, 15,  0x00000003,
     BS_AUTORADIOBUTTON, &quot;_WMI&quot;,                   NULL, 410, 10,  210, 15,  0x00000015,

     BS_GROUPBOX,        &quot;SHTDN_REASON_FLAG&quot;,      NULL, 160, 10,  200, 75,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;_USER_DEFINED&quot;,          NULL, 20,  10,  180, 15,  0x40000000,
     BS_AUTORADIOBUTTON, &quot;_PLANNED&quot;,               NULL, 35,  10,  180, 15,  0x80000000,
     BS_AUTORADIOBUTTON, &quot;_NONE&quot;,                  NULL, 50,  10,  180, 15,  0x00000000,

     BS_GROUPBOX,        &quot;EWX&quot;,                    NULL, 235, 10,  200, 75,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;_FORCE&quot;,                 NULL, 20,  10,  180, 15,  0x00000004,
     BS_AUTORADIOBUTTON, &quot;_FORCEIFHUNG&quot;,           NULL, 35,  10,  180, 15,  0x00000010,
     BS_AUTORADIOBUTTON, &quot;_NONE&quot;,                  NULL, 50,  10,  180, 15,  0x00000000,

     BS_GROUPBOX,        &quot;SHUTDOWN_TYPE&quot;,          NULL, 310, 10,  200, 90,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;LOGOFF&quot;,                 NULL, 20,  10,  180, 15,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;REBOOT&quot;,                 NULL, 35,  10,  180, 15,  0x00000002,
     BS_AUTORADIOBUTTON, &quot;SHUTDOWN&quot;,               NULL, 50,  10,  180, 15,  0x00000001,
     BS_AUTORADIOBUTTON, &quot;POWREOFF&quot;,               NULL, 65,  10,  180, 15,  0x00000008,
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/872353</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872353</guid><dc:creator><![CDATA[DarkMight1]]></dc:creator><pubDate>Wed, 14 Sep 2005 20:26:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Wed, 14 Sep 2005 20:36:56 GMT]]></title><description><![CDATA[<p>afaik muss jeder radiogruppenanfang WS_GROUP besitzen.</p>
<p>bsp:</p>
<pre><code class="language-cpp">BS_PUSHBUTTON,      &quot;Ausführen&quot;,              NULL, 410, 15,  190, 30,  0x00000000,

     BS_GROUPBOX,        &quot;SHTDN_REASON_MAJOR&quot;,     NULL, 10,  10,  200, 150, 0x00000000,
     BS_AUTORADIOBUTTON | WS_GROUP, &quot;_APPLICATION&quot;,           NULL, 20,  10,  180, 15,  0x00040000,
     BS_AUTORADIOBUTTON, &quot;_HARDWARE&quot;,              NULL, 35,  10,  180, 15,  0x00010000,
     BS_AUTORADIOBUTTON, &quot;_LEGACY_API&quot;,            NULL, 50,  10,  180, 15,  0x00070000,
     BS_AUTORADIOBUTTON, &quot;_OPERATINGSYSTEM&quot;,       NULL, 65,  10,  180, 15,  0x00020000,
     BS_AUTORADIOBUTTON, &quot;_OTHER&quot;,                 NULL, 80,  10,  180, 15,  0x00000000,
     BS_AUTORADIOBUTTON, &quot;_POWER&quot;,                 NULL, 95,  10,  180, 15,  0x00060000,
     BS_AUTORADIOBUTTON, &quot;_SOFTWARE&quot;,              NULL, 110, 10,  180, 15,  0x00030000,
     BS_AUTORADIOBUTTON, &quot;_SYSTEM&quot;,                NULL, 125, 10,  180, 15,  0x00050000,

     BS_GROUPBOX,        &quot;SHTDN_REASON_MINOR&quot;,     NULL, 10,  210, 230, 435, 0x00000000,
     BS_AUTORADIOBUTTON | WS_GROUP, &quot;_BLUSCREEN&quot;,             NULL, 20,  10,  210, 15,  0x0000000F,
     BS_AUTORADIOBUTTON, &quot;_CORDUNPLUGGED&quot;,         NULL, 35,  10,  210, 15,  0x0000000B,
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/872359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872359</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 14 Sep 2005 20:36:56 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 06:42:17 GMT]]></title><description><![CDATA[<p>Ich habe jetzt jeden ersten Radiobutton in einer Gruppe das Flag WS_GROUP mit gegeben, mein Problem hat es aber nicht gelöst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872475</guid><dc:creator><![CDATA[DarkMight1]]></dc:creator><pubDate>Thu, 15 Sep 2005 06:42:17 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 07:27:32 GMT]]></title><description><![CDATA[<p>jetzt solltest du aber ganz normal nachrichten bekommen. welche nachrichten kommen den an?</p>
<p>ps:</p>
<pre><code class="language-cpp">else if (Buttons[count].iStyle == BS_AUTORADIOBUTTON)
   // iGroupID ist wenn du hier ankommst immer 0
   Buttons[iGroupID].dwValue = Buttons[count].dwValue;
</code></pre>
<p>andere frage warum vergibst du keine id? dann könttest du dir das iteretieren in wm_command sparen und alles über die id's ansprechen</p>
<pre><code class="language-cpp">case WM_COMMAND:
	switch(LOWORD(wParam))
	{
                case ID_BTN1:
                    break;
                case ID_RADIO1:
                case ID_RADIO2:
                case ID_RADIO3:
                    break;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/872503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872503</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Thu, 15 Sep 2005 07:27:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 08:20:07 GMT]]></title><description><![CDATA[<blockquote>
<p>ps:<br />
else if (Buttons[count].iStyle == BS_AUTORADIOBUTTON)<br />
// iGroupID ist wenn du hier ankommst immer 0<br />
Buttons[iGroupID].dwValue = Buttons[count].dwValue;</p>
</blockquote>
<p>iGroupID ist nicht immer 0 wenn ich im else-Zweig ankomme sondern hat immer die ID der letzten Groupbox im Array, wenn ich jetzt noch ID's einführe so wie du das meinst wird der code recht unhandlich. Jetzt brauche ich nur das Array verändern und fertig.</p>
<blockquote>
<p>welche nachrichten kommen den an?</p>
</blockquote>
<p>Ich habe im case-Abschnitt für WM_COMMAND mal eine Mesage-Box eingebaut, wenn ich aber meine Radiobuttons drücke kommt keine MessageBox nur, wenn ich den defaultknopf drücke bekomme ich eine MessageBox, dieser Knopf liegt aber auch direkt auf dem Hauptfenster.</p>
<p>Welche Messages könnte ich den noch versuchen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872544</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872544</guid><dc:creator><![CDATA[DarkMight1]]></dc:creator><pubDate>Thu, 15 Sep 2005 08:20:07 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 08:35:54 GMT]]></title><description><![CDATA[<p>habe es gerade mal selber probiert, da ich gestern kein windows in der nähe hatte.<br />
bei mir kommt die msg an.</p>
<pre><code class="language-cpp">if(HIWORD(wParam) == BN_CLICKED) MessageBox(hwnd, &quot;click&quot;, &quot;click&quot;, MB_OK);
</code></pre>
<p>zeige doch mal deinen geänderten erstellungscode.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872554</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872554</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Thu, 15 Sep 2005 08:35:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 09:07:18 GMT]]></title><description><![CDATA[<p>Im Moment habe ich kein Möglichkeit den geänderten Code zu posten, erst heute Abend.<br />
Ich habe die Messagebox folgendermassen platziert:</p>
<pre><code>case WM_COMMAND:
    Messagbox ...
    iGroupID = 0;
</code></pre>
<p>Sind deine Buttons Child vom Hauptfenster oder von den Groupboxen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872579</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872579</guid><dc:creator><![CDATA[DarkMight1]]></dc:creator><pubDate>Thu, 15 Sep 2005 09:07:18 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 09:08:54 GMT]]></title><description><![CDATA[<p>DarkMight1 schrieb:</p>
<blockquote>
<p>Sind deine Buttons Child vom Hauptfenster oder von den Groupboxen?</p>
</blockquote>
<p>vom hauptfenster</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872582</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Thu, 15 Sep 2005 09:08:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Child-Fenster on Thu, 15 Sep 2005 09:58:03 GMT]]></title><description><![CDATA[<p>Dann klappt es bei mir auch allerdings habe ich dann den Nachteil das ich Groupboxen und Radiobuttons wieder getrennt habe, und z.b. nicht zusammen verschieben kann.</p>
<p>Es kann ja nicht im Sinne des Erfinders sein, das ich zwar Buttons innerhalb von Groupboxen organisieren kann, dann aber keine Möglichkeit habe diese Buttons auszuwerten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/872630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/872630</guid><dc:creator><![CDATA[DarkMight1]]></dc:creator><pubDate>Thu, 15 Sep 2005 09:58:03 GMT</pubDate></item></channel></rss>