<?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[CWinThread killen]]></title><description><![CDATA[<p>Wie kann ich ein Thread das mit AfxBeginThread() gestartet wurde, killen? In MSDN steht AfxEndThread(), aber wie kann ich diese Funktion aufrufen wenn ich z.B. auf ein Button klicke. Die Funktion muss ja innerhalb des Threads aufgerufen werden. Thnx im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/5810/cwinthread-killen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 22:14:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/5810.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 17 May 2003 23:38:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CWinThread killen on Sat, 17 May 2003 23:38:00 GMT]]></title><description><![CDATA[<p>Wie kann ich ein Thread das mit AfxBeginThread() gestartet wurde, killen? In MSDN steht AfxEndThread(), aber wie kann ich diese Funktion aufrufen wenn ich z.B. auf ein Button klicke. Die Funktion muss ja innerhalb des Threads aufgerufen werden. Thnx im Voraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28224</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28224</guid><dc:creator><![CDATA[Franky]]></dc:creator><pubDate>Sat, 17 May 2003 23:38:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sat, 17 May 2003 23:59:00 GMT]]></title><description><![CDATA[<p>siehe hier: <a href="http://www.henkessoft.de/mfc_einsteigerbuch_kapitel17.htm" rel="nofollow">http://www.henkessoft.de/mfc_einsteigerbuch_kapitel17.htm</a></p>
<pre><code class="language-cpp">class CThread001Dlg : public CDialog 
 { 
 // Konstruktion 
 public: 
 static UINT thrFunction (LPVOID pParam); 
 CThread001Dlg(CWnd* pParent = NULL); // Standard-Konstruktor 
  ... 
  ... 
 private: 
 int m_Flag; 
 } 
 //...  

 void CThread001Dlg::OnButtonStart()  
 { 
   m_Flag = 1; 
   CWinThread* pThread = AfxBeginThread (thrFunction, &amp;m_Flag); 
 } 

 void CThread001Dlg::OnButtonStop()  
 { 
   m_Flag = 0; 
 } 

 UINT CThread001Dlg::thrFunction(LPVOID pParam) 
 { 
   int* pFlag = (int*) pParam; 
   while (*pFlag)  
   { 
     // thread action ... 
   } 
   return 0; 
 }
</code></pre>
<p>[ Dieser Beitrag wurde am 18.05.2003 um 02:02 Uhr von <strong>Erhard Henkes</strong> editiert. ]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28225</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Sat, 17 May 2003 23:59:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sun, 18 May 2003 02:11:00 GMT]]></title><description><![CDATA[<p>Hi,<br />
leider funktioniert es nicht. Ich habe mehrere Pointer in meiner Funktion die nicht gelöscht werden, oder das Programm stürtzt einfach ab.<br />
Ich habe es so geschafft:</p>
<pre><code class="language-cpp">UpdateData();
    HANDLE hThread = m_pThread-&gt;m_hThread;
    TerminateThread(hThread,NULL);
</code></pre>
<p>ist es empfehlenswert TerminateThread() zu verwenden oder eher nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28226</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28226</guid><dc:creator><![CDATA[Franky]]></dc:creator><pubDate>Sun, 18 May 2003 02:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sun, 18 May 2003 02:24:00 GMT]]></title><description><![CDATA[<p>eher nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28227</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sun, 18 May 2003 02:24:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sun, 18 May 2003 02:35:00 GMT]]></title><description><![CDATA[<p>Aha, und warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28228</guid><dc:creator><![CDATA[Franky]]></dc:creator><pubDate>Sun, 18 May 2003 02:35:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sun, 18 May 2003 09:18:00 GMT]]></title><description><![CDATA[<p>ho,</p>
<p>Guck in die MSDN. Da steht warum die Funktion &quot;dangerous&quot; ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28229</guid><dc:creator><![CDATA[f]]></dc:creator><pubDate>Sun, 18 May 2003 09:18:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sun, 18 May 2003 09:27:00 GMT]]></title><description><![CDATA[<p>Schau mal in meinem Kapitel, da ist noch eine komplexere Methode unter Umgehung der statischen Funktion. UpdateData(...) ist leider auch nicht thread-sicher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28230</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Sun, 18 May 2003 09:27:00 GMT</pubDate></item><item><title><![CDATA[Reply to CWinThread killen on Sun, 18 May 2003 20:52:00 GMT]]></title><description><![CDATA[<p>Danke euch allen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/28231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/28231</guid><dc:creator><![CDATA[Franky]]></dc:creator><pubDate>Sun, 18 May 2003 20:52:00 GMT</pubDate></item></channel></rss>