<?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 Threads!]]></title><description><![CDATA[<p>Hi Forum,<br />
hab Problem mit Threads, und zwar jedes mal wenn ich aus einem Thread in ein CListCtrl Control schreiben will, also Daten ausgeben will, aus einer Thread Funktion rufe ich eine Function auf, die die Daten anzeigen soll, das Programm bleibt an der Stelle stehen :</p>
<pre><code>int iItemNummer;
iItemNummer = pList-&gt;GetItemCount(); // hier kommt der nicht weiter!!
pList-&gt;InsertItem(iItemNummer, csItemData);
</code></pre>
<p>mit ::SendMessage(...); gehts, aber wie kann ich sonst auser mit ::SendMessage(...); aus einem Thread auf ein Control zugerifen und Daten ausgeben, das Programm erzeugt mehrere Threads die dann jeder für sich seine Daten anzeigen soll und alle in das selbe Control !? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
danke<br />
pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/122795/problem-mit-threads</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 09:48:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/122795.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 10 Oct 2005 09:04:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Threads! on Mon, 10 Oct 2005 09:05:26 GMT]]></title><description><![CDATA[<p>Hi Forum,<br />
hab Problem mit Threads, und zwar jedes mal wenn ich aus einem Thread in ein CListCtrl Control schreiben will, also Daten ausgeben will, aus einer Thread Funktion rufe ich eine Function auf, die die Daten anzeigen soll, das Programm bleibt an der Stelle stehen :</p>
<pre><code>int iItemNummer;
iItemNummer = pList-&gt;GetItemCount(); // hier kommt der nicht weiter!!
pList-&gt;InsertItem(iItemNummer, csItemData);
</code></pre>
<p>mit ::SendMessage(...); gehts, aber wie kann ich sonst auser mit ::SendMessage(...); aus einem Thread auf ein Control zugerifen und Daten ausgeben, das Programm erzeugt mehrere Threads die dann jeder für sich seine Daten anzeigen soll und alle in das selbe Control !? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
danke<br />
pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/888632</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/888632</guid><dc:creator><![CDATA[pixel]]></dc:creator><pubDate>Mon, 10 Oct 2005 09:05:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Threads! on Wed, 12 Oct 2005 10:30:10 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>bei mir funktioniert sowas ähnliches. Ich habe einen globalen Zeiger auf die Liste. Es ist wichtig, daß der Zeiger im Hauptthread des Programms initialisiert wird.</p>
<p>Ob das die Lösung für Dich ist, kann ich aber nicht versprechen.</p>
<p>Grüße<br />
Echo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/890429</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/890429</guid><dc:creator><![CDATA[Echolon1]]></dc:creator><pubDate>Wed, 12 Oct 2005 10:30:10 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Threads! on Wed, 12 Oct 2005 10:38:30 GMT]]></title><description><![CDATA[<p>pixel schrieb:</p>
<blockquote>
<p>wie kann ich sonst auser mit ::SendMessage(...); aus einem Thread auf ein Control zugerifen</p>
</blockquote>
<p>Mit PostMessage. Bei MFC darfst du Methoden einer Fensterklasse nur aus dem Thread aufrufen, der das Fenster erstellt hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/890438</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/890438</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 12 Oct 2005 10:38:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Threads! on Wed, 12 Oct 2005 10:41:14 GMT]]></title><description><![CDATA[<p>pixel schrieb:</p>
<blockquote>
<p>Hi Forum,</p>
<p>.... aber wie kann ich sonst auser mit ::SendMessage(...); aus einem Thread auf ein Control zugerifen und Daten ausgeben, das Programm erzeugt mehrere Threads die dann jeder für sich seine Daten anzeigen soll und alle in das selbe Control !? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
danke<br />
pixel</p>
</blockquote>
<p>du übergibst beim Starten des Threads den Zeiger des Dialoges bzw. des Controlls.</p>
<pre><code class="language-cpp">AfxBeginThread(myThreadFunc, this);
</code></pre>
<p>Im Threadcode castest du dann den void* Parameter auf den Dialog, somit kannst du auf alle Public-Elemente zugreiffen..</p>
<pre><code class="language-cpp">UINT myThreadFunc(LPVOID param){
 MyDialog* pDlg = (MyDialog*) param;
 pDlg-&gt;m_List.DoSomething(....);

 return 0;
}
</code></pre>
<p>.. oder du übergibst anstatt then this Zeiger nur den Zeiger des entsprechenden Elementes.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/890441</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/890441</guid><dc:creator><![CDATA[sky21]]></dc:creator><pubDate>Wed, 12 Oct 2005 10:41:14 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Threads! on Wed, 12 Oct 2005 10:47:55 GMT]]></title><description><![CDATA[<p>Hallo,<br />
danke für eure Tipps, ich hab das mit der globalen Variablen gemacht, aber das mit dem pointer auf den Dialog finde ich super!</p>
<p>mfg<br />
pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/890446</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/890446</guid><dc:creator><![CDATA[pixel]]></dc:creator><pubDate>Wed, 12 Oct 2005 10:47:55 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Threads! on Thu, 13 Oct 2005 04:39:37 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>pixel schrieb:</p>
<blockquote>
<p>wie kann ich sonst auser mit ::SendMessage(...); aus einem Thread auf ein Control zugerifen</p>
</blockquote>
<p>Mit PostMessage. Bei MFC darfst du Methoden einer Fensterklasse nur aus dem Thread aufrufen, der das Fenster erstellt hat.</p>
</blockquote>
<p>Das ist nicht richtig.<br />
Erstellt man eine von CWinThread abgeleitetet Klasse und übergibt den this an den Thread kann man von Thread auf die Steuerelemente zugreifen.<br />
Auch auf ListCtrl.<br />
Ich hatte sogar mal ein Programm wo 60 Threads in das ListCtrl geschrieben haben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/890999</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/890999</guid><dc:creator><![CDATA[Unix-Tom]]></dc:creator><pubDate>Thu, 13 Oct 2005 04:39:37 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Threads! on Thu, 13 Oct 2005 04:54:36 GMT]]></title><description><![CDATA[<p>Ich weiß, dass das in vielen Fällen funktioniert. Wenn die MFC-Methode nur ein dünner Wrapper um einen SendMessage-Aufruf ist, klappt das hervorragend.</p>
<p>Microsoft Systems Journal schrieb:</p>
<blockquote>
<p>[...] you can't pass a CWnd object from one thread to another, and MFC advises against it. Sometimes it will work, but in general it fails because, among other things, the AssertValid function for CWnds checks that the CWnd object exists in the (temporary or permanent) handle map associated with the same HWND as m_hWnd. But the CWnd only exists in the thread where it was created, or the thread from which CWnd::FromHandle was called in the case of a temporary object. That CWnd will not exist in the handle map of any other thread, and if you pass it to another thread, the code is sure to crash as soon as it runs into one of the zillions of ASSERT_VALID checks sprinkled throughout MFC.</p>
</blockquote>
<p>Quelle: <a href="http://www.microsoft.com/msj/0997/c0997.aspx" rel="nofollow">http://www.microsoft.com/msj/0997/c0997.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/891003</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891003</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Thu, 13 Oct 2005 04:54:36 GMT</pubDate></item></channel></rss>