<?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[Programmabbruch... Nur warum????]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>ich versuche in meinem Programm einen neuen (Arbeits)-Thread zu starten. Es kompiliert alles wunderbar allerdings kommt es zu einem Programmabsturz wenn ich dir Methode start(...) aufrufe um den Thread zu starten. Das komische bei der Sache ist das er bei einer Membervariablen meckert (m_bStopThread) und zwar mit dem Kommentar:<br />
m_bStopThread CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden bool</p>
<p>Irgendwie komisch... Kann mir jemand helfen? Hier der Code (teilweise aus Frank Budszuhn Buch übernommen)</p>
<pre><code class="language-cpp">#include &quot;StdAfx.h&quot;
#include &quot;.\eprecthread.h&quot;

struct RecCall
{
	CEPRecThread *pRecThread;
	HWND hWnd;
	int sleepFor;
};

CEPRecThread::CEPRecThread(void)
{		
	m_bStopThread = false;
}

CEPRecThread::~CEPRecThread(void)
{
}

UINT CEPRecThread::run(LPVOID pParam)
{
	RecCall * call = (RecCall *)pParam;
	ASSERT(AfxIsValidAddress (call-&gt;pRecThread, sizeof(RecCall)));
	return call-&gt;pRecThread-&gt;run(call-&gt;hWnd, call-&gt;sleepFor);
}

void CEPRecThread::start(HWND hWnd, int sleepFor)
{	
	static RecCall call;

	call.hWnd = hWnd;
	call.pRecThread = this;
	call.sleepFor = sleepFor;	
	m_bStopThread = false;

	m_pThread = AfxBeginThread(	run, 
								&amp;call, 
								THREAD_PRIORITY_BELOW_NORMAL);
	m_pThread-&gt;m_bAutoDelete = false;
}

UINT CEPRecThread::run(HWND hWnd, int sleepFor)
{
	while(TRUE)
	{
		//AfxMessageBox(&quot;Thread rennt ...&quot;);
		Sleep(sleepFor*1000);
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/64669/programmabbruch-nur-warum</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 01:26:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/64669.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Feb 2004 15:05:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Programmabbruch... Nur warum???? on Thu, 12 Feb 2004 15:05:47 GMT]]></title><description><![CDATA[<p>Hi Leute,</p>
<p>ich versuche in meinem Programm einen neuen (Arbeits)-Thread zu starten. Es kompiliert alles wunderbar allerdings kommt es zu einem Programmabsturz wenn ich dir Methode start(...) aufrufe um den Thread zu starten. Das komische bei der Sache ist das er bei einer Membervariablen meckert (m_bStopThread) und zwar mit dem Kommentar:<br />
m_bStopThread CXX0030: Fehler: Ausdruck kann nicht ausgewertet werden bool</p>
<p>Irgendwie komisch... Kann mir jemand helfen? Hier der Code (teilweise aus Frank Budszuhn Buch übernommen)</p>
<pre><code class="language-cpp">#include &quot;StdAfx.h&quot;
#include &quot;.\eprecthread.h&quot;

struct RecCall
{
	CEPRecThread *pRecThread;
	HWND hWnd;
	int sleepFor;
};

CEPRecThread::CEPRecThread(void)
{		
	m_bStopThread = false;
}

CEPRecThread::~CEPRecThread(void)
{
}

UINT CEPRecThread::run(LPVOID pParam)
{
	RecCall * call = (RecCall *)pParam;
	ASSERT(AfxIsValidAddress (call-&gt;pRecThread, sizeof(RecCall)));
	return call-&gt;pRecThread-&gt;run(call-&gt;hWnd, call-&gt;sleepFor);
}

void CEPRecThread::start(HWND hWnd, int sleepFor)
{	
	static RecCall call;

	call.hWnd = hWnd;
	call.pRecThread = this;
	call.sleepFor = sleepFor;	
	m_bStopThread = false;

	m_pThread = AfxBeginThread(	run, 
								&amp;call, 
								THREAD_PRIORITY_BELOW_NORMAL);
	m_pThread-&gt;m_bAutoDelete = false;
}

UINT CEPRecThread::run(HWND hWnd, int sleepFor)
{
	while(TRUE)
	{
		//AfxMessageBox(&quot;Thread rennt ...&quot;);
		Sleep(sleepFor*1000);
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/457883</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/457883</guid><dc:creator><![CDATA[Win32Noob]]></dc:creator><pubDate>Thu, 12 Feb 2004 15:05:47 GMT</pubDate></item><item><title><![CDATA[Reply to Programmabbruch... Nur warum???? on Thu, 12 Feb 2004 15:12:16 GMT]]></title><description><![CDATA[<p>Ok Leute ich bin echt ein NOOB, oh man...<br />
Vielleicht sollte man die Klasse erstmal instanziieren bevor man sie benutzt ...</p>
<p>Ich bin echt ne Pappnase <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/457893</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/457893</guid><dc:creator><![CDATA[Win32Noob]]></dc:creator><pubDate>Thu, 12 Feb 2004 15:12:16 GMT</pubDate></item></channel></rss>