<?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 stack overflow]]></title><description><![CDATA[<p>Hallo ich habe ein Problem und bin am verzweifeln, es liegt an der Switch case anweisung, weil wenn ich diese auskommentiere geht das programm, aber sobald ich es laufen lasse, kommt der Fehler stack overflow... ich weiß nicht mehr weiter <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Kann mir einer die Lösung veraten mir fallen schon die Haare raus</p>
<p>code :</p>
<pre><code>CString strAusgabe;
	CString strSpannung, strStrom, strWiderstand;
	float fSpannung, fStrom, fWiderstand;

  switch(m_cmbKombo1.GetCurSel())
	{
	case 0: // U=R*I
		// Zuweisen der Bezeichnungen
		m_stat1.SetWindowText(&quot;Widerstand [Ohm]&quot;);
		m_stat2.SetWindowText(&quot;Strom [A]&quot;);
		m_stat3.SetWindowText(&quot;Spannung [V]&quot;);

		// m_ctlEdit3. GetWindowText (strSpannung  );
		m_ctlEdit2.GetWindowText (strStrom     );
		m_ctlEdit1. GetWindowText (strWiderstand);

		// fSpannung   = atof(strSpannung  );
		fStrom      = atof(strStrom     );
		fWiderstand = atof(strWiderstand);

		strAusgabe.Format(&quot;U = %f V&quot;,fStrom * fWiderstand);
		m_ctlEdit3.SetWindowText(strAusgabe);
		break;
	case 1: // I=U/R
		// Zuweisen der Bezeichnungen
		m_stat1.SetWindowText(&quot;Spannung [V]&quot;);
		m_stat2.SetWindowText(&quot;Widerstand [Ohm]&quot;);
		m_stat3.SetWindowText(&quot;Strom [A]&quot;);
		// Ergebnis

		m_ctlEdit1. GetWindowText (strSpannung  );
		// m_ctrlEdit3.GetWindowText (strStrom     );
		m_ctlEdit2. GetWindowText (strWiderstand);

		fSpannung   = atof(strSpannung  );
		// fStrom      = atof(strStrom     );
		fWiderstand = atof(strWiderstand);

		if (fWiderstand&gt;=0.0000001) strAusgabe.Format(&quot;I = %f V&quot;,fSpannung / fWiderstand);
		else strAusgabe.Format(&quot;Darf man NICHT&quot;);

		m_ctlEdit3.SetWindowText(strAusgabe);

		break;
	case 2: // R=U/I
		// Zuweisen der Bezeichnungen
		m_stat1.SetWindowText(&quot;Spannung [V]&quot;);
		m_stat2.SetWindowText(&quot;Strom [A]&quot;);
		m_stat3.SetWindowText(&quot;Widerstand [Ohm]&quot;);

		m_ctlEdit1. GetWindowText (strSpannung  );
		m_ctlEdit2.GetWindowText (strStrom     );
		//m_ctlEdit3. GetWindowText (strWiderstand);

		fSpannung   = atof(strSpannung  );
		fStrom      = atof(strStrom     );
		// fWiderstand = atof(strWiderstand);

		if (fStrom&gt;=0.0000001) strAusgabe.Format(&quot;R = %f V&quot;,fSpannung / fStrom);
		else strAusgabe.Format(&quot;Darf man NICHT&quot;);

		m_ctlEdit3.SetWindowText(strAusgabe);

		break;*/
	default: 
		//AfxMessageBox(&quot;Bitte stellen Sie den Computer ab.&quot;);
		break;
	}

    m_ctlEdit3.SetWindowText(strAusgabe);

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/191772/problem-mit-stack-overflow</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 01:26:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/191772.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Sep 2007 11:56:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit stack overflow on Thu, 06 Sep 2007 12:01:30 GMT]]></title><description><![CDATA[<p>Hallo ich habe ein Problem und bin am verzweifeln, es liegt an der Switch case anweisung, weil wenn ich diese auskommentiere geht das programm, aber sobald ich es laufen lasse, kommt der Fehler stack overflow... ich weiß nicht mehr weiter <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Kann mir einer die Lösung veraten mir fallen schon die Haare raus</p>
<p>code :</p>
<pre><code>CString strAusgabe;
	CString strSpannung, strStrom, strWiderstand;
	float fSpannung, fStrom, fWiderstand;

  switch(m_cmbKombo1.GetCurSel())
	{
	case 0: // U=R*I
		// Zuweisen der Bezeichnungen
		m_stat1.SetWindowText(&quot;Widerstand [Ohm]&quot;);
		m_stat2.SetWindowText(&quot;Strom [A]&quot;);
		m_stat3.SetWindowText(&quot;Spannung [V]&quot;);

		// m_ctlEdit3. GetWindowText (strSpannung  );
		m_ctlEdit2.GetWindowText (strStrom     );
		m_ctlEdit1. GetWindowText (strWiderstand);

		// fSpannung   = atof(strSpannung  );
		fStrom      = atof(strStrom     );
		fWiderstand = atof(strWiderstand);

		strAusgabe.Format(&quot;U = %f V&quot;,fStrom * fWiderstand);
		m_ctlEdit3.SetWindowText(strAusgabe);
		break;
	case 1: // I=U/R
		// Zuweisen der Bezeichnungen
		m_stat1.SetWindowText(&quot;Spannung [V]&quot;);
		m_stat2.SetWindowText(&quot;Widerstand [Ohm]&quot;);
		m_stat3.SetWindowText(&quot;Strom [A]&quot;);
		// Ergebnis

		m_ctlEdit1. GetWindowText (strSpannung  );
		// m_ctrlEdit3.GetWindowText (strStrom     );
		m_ctlEdit2. GetWindowText (strWiderstand);

		fSpannung   = atof(strSpannung  );
		// fStrom      = atof(strStrom     );
		fWiderstand = atof(strWiderstand);

		if (fWiderstand&gt;=0.0000001) strAusgabe.Format(&quot;I = %f V&quot;,fSpannung / fWiderstand);
		else strAusgabe.Format(&quot;Darf man NICHT&quot;);

		m_ctlEdit3.SetWindowText(strAusgabe);

		break;
	case 2: // R=U/I
		// Zuweisen der Bezeichnungen
		m_stat1.SetWindowText(&quot;Spannung [V]&quot;);
		m_stat2.SetWindowText(&quot;Strom [A]&quot;);
		m_stat3.SetWindowText(&quot;Widerstand [Ohm]&quot;);

		m_ctlEdit1. GetWindowText (strSpannung  );
		m_ctlEdit2.GetWindowText (strStrom     );
		//m_ctlEdit3. GetWindowText (strWiderstand);

		fSpannung   = atof(strSpannung  );
		fStrom      = atof(strStrom     );
		// fWiderstand = atof(strWiderstand);

		if (fStrom&gt;=0.0000001) strAusgabe.Format(&quot;R = %f V&quot;,fSpannung / fStrom);
		else strAusgabe.Format(&quot;Darf man NICHT&quot;);

		m_ctlEdit3.SetWindowText(strAusgabe);

		break;*/
	default: 
		//AfxMessageBox(&quot;Bitte stellen Sie den Computer ab.&quot;);
		break;
	}

    m_ctlEdit3.SetWindowText(strAusgabe);

}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1360170</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360170</guid><dc:creator><![CDATA[ice101]]></dc:creator><pubDate>Thu, 06 Sep 2007 12:01:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit stack overflow on Thu, 06 Sep 2007 12:12:24 GMT]]></title><description><![CDATA[<p>Kann es sein, dass Du diesen Code in einem EN_CHANGE Handler ausführst?</p>
<p>In diesem Fall wird durch ein SetWindowText ein neuer EN_CHANGE ausgelöst was zur Rekursion führt. Ist dies so? Dann setze eine Variable die den rekursiven Aufruf verhindert.</p>
<p>Nützlich bei einem Stackoverflow ist ein Blick im Debugger auf den Callstack!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360180</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360180</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 06 Sep 2007 12:12:24 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit stack overflow on Thu, 06 Sep 2007 13:20:20 GMT]]></title><description><![CDATA[<p>mein callstack ist ziemlich lang</p>
<p>und mit welcher variable sollte ich den rekrusiven aufruf verhindern ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360227</guid><dc:creator><![CDATA[ice101]]></dc:creator><pubDate>Thu, 06 Sep 2007 13:20:20 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit stack overflow on Thu, 06 Sep 2007 13:51:00 GMT]]></title><description><![CDATA[<p>ice101 schrieb:</p>
<blockquote>
<p>mein callstack ist ziemlich lang</p>
<p>und mit welcher variable sollte ich den rekrusiven aufruf verhindern ?</p>
</blockquote>
<p>Mit einer eigenen in der Klasse...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360250</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360250</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 06 Sep 2007 13:51:00 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit stack overflow on Fri, 07 Sep 2007 16:25:58 GMT]]></title><description><![CDATA[<p>einfach eine statische Variable deklarieren</p>
<pre><code class="language-cpp">void OnChange ()
{
  static bNotAtWork = true;

  if (bNotAtWork)
  {
     bNotAtWork = false;

     ...
     SetWindowText (...); // d.h. erneut OnChange ()
     ...

     bNotAtWork = true;
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1360933</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360933</guid><dc:creator><![CDATA[a]]></dc:creator><pubDate>Fri, 07 Sep 2007 16:25:58 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit stack overflow on Fri, 07 Sep 2007 17:09:06 GMT]]></title><description><![CDATA[<p>Statische Variablen sind für diesen Fall nicht gut. Besser man baut die Variable in der Klasse ein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1360958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1360958</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 07 Sep 2007 17:09:06 GMT</pubDate></item></channel></rss>