<?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[Wo ist mein denkfehler]]></title><description><![CDATA[<p>ich brauch in meinem programm einige radiobuttons</p>
<p>da dacht ich - machste die inner schleife:</p>
<pre><code class="language-cpp">for(int i=0; i&lt;8; ++i){
    LoadString(hInst, IDS_NAME+i, strName, sizeof(strName)/sizeof(strName[0]));
    m_Radios[i] = CreateWindow(_T(&quot;button&quot;), strName, WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, front, 2, 80, 20, hWnd, (HMENU)ID_RADIO1+i, hInst, NULL);
    front += 80;
    ::SendMessage(m_Radios[i], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
}
</code></pre>
<p>alles gut und schoen</p>
<p>aber wenn ich dann die messages abfrag:</p>
<pre><code class="language-cpp">switch(message)	{
    case WM_COMMAND:
        switch(LOWORD(wParam)){
            case ID_RADIO1:
                button = 1;
                CheckRadioButton(hWnd, ID_RADIO1, ID_RADIO8, ID_RADIO1);
                break;
            case ID_RADIO2:
                button = 2;
                CheckRadioButton(hWnd, ID_RADIO1, ID_RADIO8, ID_RADIO2);
                break;
.
.
.
</code></pre>
<p>kommt die message immer falsch - bei radiobutton 1 stimmts, da ist dann wParam die richtige ID, aber jede nachfolgende ist immer ein paar nummern zu hoch</p>
<pre><code class="language-cpp">#define ID_RADIO1 40001  // Message: 40001
#define ID_RADIO2 40002  // Message: 40005
#define ID_RADIO3 40003  // Message: 40009
#define ID_RADIO4 40004  // Message: 40012
.
.
</code></pre>
<p>im Release Mode sogar noch mehr</p>
<p>wenn ich aber die elemente einzelnd erstell:</p>
<pre><code class="language-cpp">LoadString(hInst, IDS_NAME, strName, sizeof(strName)/sizeof(strName[0]));
m_Radios[0] = CreateWindow(_T(&quot;button&quot;), strName, WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, front, 2, 80, 20, hWnd, (HMENU)ID_RADIO1, hInst, NULL);
::SendMessage(m_Radios[0], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
front += 80;
LoadString(hInst, IDS_NAMEA, strName, sizeof(strName)/sizeof(strName[0]));
m_Radios[1] = CreateWindow(_T(&quot;button&quot;), strName, WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, front, 2, 80, 20, hWnd, (HMENU)ID_RADIO2, hInst, NULL);
::SendMessage(m_Radios[1], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
front += 80;
</code></pre>
<p>dann funktionieren die messages richtig {so hab ich es bisher}</p>
<p>wo ist das problem ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/168825/wo-ist-mein-denkfehler</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 02:23:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/168825.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Dec 2006 12:29:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 12:29:20 GMT]]></title><description><![CDATA[<p>ich brauch in meinem programm einige radiobuttons</p>
<p>da dacht ich - machste die inner schleife:</p>
<pre><code class="language-cpp">for(int i=0; i&lt;8; ++i){
    LoadString(hInst, IDS_NAME+i, strName, sizeof(strName)/sizeof(strName[0]));
    m_Radios[i] = CreateWindow(_T(&quot;button&quot;), strName, WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, front, 2, 80, 20, hWnd, (HMENU)ID_RADIO1+i, hInst, NULL);
    front += 80;
    ::SendMessage(m_Radios[i], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
}
</code></pre>
<p>alles gut und schoen</p>
<p>aber wenn ich dann die messages abfrag:</p>
<pre><code class="language-cpp">switch(message)	{
    case WM_COMMAND:
        switch(LOWORD(wParam)){
            case ID_RADIO1:
                button = 1;
                CheckRadioButton(hWnd, ID_RADIO1, ID_RADIO8, ID_RADIO1);
                break;
            case ID_RADIO2:
                button = 2;
                CheckRadioButton(hWnd, ID_RADIO1, ID_RADIO8, ID_RADIO2);
                break;
.
.
.
</code></pre>
<p>kommt die message immer falsch - bei radiobutton 1 stimmts, da ist dann wParam die richtige ID, aber jede nachfolgende ist immer ein paar nummern zu hoch</p>
<pre><code class="language-cpp">#define ID_RADIO1 40001  // Message: 40001
#define ID_RADIO2 40002  // Message: 40005
#define ID_RADIO3 40003  // Message: 40009
#define ID_RADIO4 40004  // Message: 40012
.
.
</code></pre>
<p>im Release Mode sogar noch mehr</p>
<p>wenn ich aber die elemente einzelnd erstell:</p>
<pre><code class="language-cpp">LoadString(hInst, IDS_NAME, strName, sizeof(strName)/sizeof(strName[0]));
m_Radios[0] = CreateWindow(_T(&quot;button&quot;), strName, WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, front, 2, 80, 20, hWnd, (HMENU)ID_RADIO1, hInst, NULL);
::SendMessage(m_Radios[0], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
front += 80;
LoadString(hInst, IDS_NAMEA, strName, sizeof(strName)/sizeof(strName[0]));
m_Radios[1] = CreateWindow(_T(&quot;button&quot;), strName, WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON, front, 2, 80, 20, hWnd, (HMENU)ID_RADIO2, hInst, NULL);
::SendMessage(m_Radios[1], WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
front += 80;
</code></pre>
<p>dann funktionieren die messages richtig {so hab ich es bisher}</p>
<p>wo ist das problem ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1198943</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1198943</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Thu, 28 Dec 2006 12:29:20 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 13:02:54 GMT]]></title><description><![CDATA[<p>Versuch mal statt ID_RADIO1+i</p>
<p>den reinen zahlenwert deiner id 40001+i zu verwenden</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1198980</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1198980</guid><dc:creator><![CDATA[Ascharan]]></dc:creator><pubDate>Thu, 28 Dec 2006 13:02:54 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 13:07:11 GMT]]></title><description><![CDATA[<p>dann ist (im Debug) nur Radio1 und Radio2 richtig, die restlichen werden weiterhin nicht erreicht<br />
sehr raetselhaft #gruebel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1198988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1198988</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Thu, 28 Dec 2006 13:07:11 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 13:08:27 GMT]]></title><description><![CDATA[<p>Das dürfte keinen Unterschied machen. Ich glaube eher du müsstest das ID_RADIO1+i in Klammern setzen bevor du es in HMENU castest.<br />
Wie du es gemacht hast, wird ID_RADIO1 zum Zeiger gecastet (=HMNUE). Wenn du den Zeiger dann um eins erhöhst, zeigt er 4 Byte weiter, was ja nicht sein soll, der Wert soll ja nur um <strong>eins</strong> erhöht werden.</p>
<pre><code class="language-cpp">void main()
{
	HMENU Bla = NULL;
	Bla++;
	printf( &quot;%.8X\n&quot;, Bla );  // 0x00000004
}
</code></pre>
<p>Also einfach (HMENU)(ID_RADIO1+i) <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1198989</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1198989</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Thu, 28 Dec 2006 13:08:27 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 13:28:00 GMT]]></title><description><![CDATA[<p>hei klasse - funktioniert</p>
<p>ne ahnung wie ich diese warnung unterbinden kann ?</p>
<pre><code>warning C4312: 'type cast' : conversion from 'int' to 'HMENU' of greater size
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1199006</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199006</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Thu, 28 Dec 2006 13:28:00 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 13:32:10 GMT]]></title><description><![CDATA[<p>#pragma warning ( disable: 4312 )<br />
Ist eher ein medium-guter Weg, aber vielleicht trotzdem gut zu wissen...</p>
<p>Besser ist: (HMENU)(ULONG_PTR)(ID_RADIO1+i). Das ist dann &quot;sauber&quot;...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1199010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199010</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Thu, 28 Dec 2006 13:32:10 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Thu, 28 Dec 2006 13:41:33 GMT]]></title><description><![CDATA[<p>vielen dank - diese saubere loesung gefaellt sehr gut, bin nur nicht auf den unsigned long pointer gekommen {=</p>
<p>dankeschoen {=</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1199014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199014</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Thu, 28 Dec 2006 13:41:33 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Fri, 29 Dec 2006 01:20:30 GMT]]></title><description><![CDATA[<p>Du solltest Du Warnung aber möglichst danach wieder aktivieren mit:</p>
<pre><code class="language-cpp">#pragma warning(default: 4312)
</code></pre>
<p>da diese in manchen Fällen auch wichtig ist (und zu Fehlern führen kann).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1199283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199283</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Fri, 29 Dec 2006 01:20:30 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist mein denkfehler on Fri, 29 Dec 2006 07:15:33 GMT]]></title><description><![CDATA[<p>ich hab die warnung gar nicht deaktiviert {o;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1199302</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1199302</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Fri, 29 Dec 2006 07:15:33 GMT</pubDate></item></channel></rss>