<?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[MultiThread-UpdateAllViews()-Konstruktion verhindert Aktualisierung der Toolbar]]></title><description><![CDATA[<p>Hab mir mit Hilfe aus diesem Forum so eine Konstruktion gemacht, damit UpdateAllViews() noch funktioniert...</p>
<pre><code class="language-cpp">m_isRunning=1;
	const int cObjects = 1; 
	HANDLE phObjects[cObjects]; 
	phObjects[0] = (HANDLE)event; 
	AfxBeginThread(Start,this);
	while (m_isRunning) 
	{ 
		DWORD result ;  
		MSG msg ;  
		while( PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))  
		{  
			if (msg.message == WM_QUIT) {
			  ::PostQuitMessage(0);
				return;  
			}
		  DispatchMessage(&amp;msg);  
		}
		result = MsgWaitForMultipleObjects( cObjects, phObjects, FALSE, INFINITE, QS_ALLINPUT);  
		if (result == (WAIT_OBJECT_0 + cObjects)) 
		{ 
		  continue; 
		}  
		else  
		{  
		  UpdateAllViews(NULL); 
		}
	}
</code></pre>
<p>Leider funzt jetzt das Aktivieren/Deaktivieren des Start- bzw. Stopbuttons in der Toolbar nich mehr...scheinbar reicht DispatchMessage(&amp;msg) nicht...was muss ich noch machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/55303/multithread-updateallviews-konstruktion-verhindert-aktualisierung-der-toolbar</link><generator>RSS for Node</generator><lastBuildDate>Tue, 02 Jun 2026 00:23:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/55303.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Nov 2003 13:17:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MultiThread-UpdateAllViews()-Konstruktion verhindert Aktualisierung der Toolbar on Sat, 15 Nov 2003 13:17:41 GMT]]></title><description><![CDATA[<p>Hab mir mit Hilfe aus diesem Forum so eine Konstruktion gemacht, damit UpdateAllViews() noch funktioniert...</p>
<pre><code class="language-cpp">m_isRunning=1;
	const int cObjects = 1; 
	HANDLE phObjects[cObjects]; 
	phObjects[0] = (HANDLE)event; 
	AfxBeginThread(Start,this);
	while (m_isRunning) 
	{ 
		DWORD result ;  
		MSG msg ;  
		while( PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))  
		{  
			if (msg.message == WM_QUIT) {
			  ::PostQuitMessage(0);
				return;  
			}
		  DispatchMessage(&amp;msg);  
		}
		result = MsgWaitForMultipleObjects( cObjects, phObjects, FALSE, INFINITE, QS_ALLINPUT);  
		if (result == (WAIT_OBJECT_0 + cObjects)) 
		{ 
		  continue; 
		}  
		else  
		{  
		  UpdateAllViews(NULL); 
		}
	}
</code></pre>
<p>Leider funzt jetzt das Aktivieren/Deaktivieren des Start- bzw. Stopbuttons in der Toolbar nich mehr...scheinbar reicht DispatchMessage(&amp;msg) nicht...was muss ich noch machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/394609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/394609</guid><dc:creator><![CDATA[Flo347]]></dc:creator><pubDate>Sat, 15 Nov 2003 13:17:41 GMT</pubDate></item><item><title><![CDATA[Reply to MultiThread-UpdateAllViews()-Konstruktion verhindert Aktualisierung der Toolbar on Sat, 15 Nov 2003 15:22:07 GMT]]></title><description><![CDATA[<p>Hab der Thread-Funktion eine Struktur mit der Handle des Views übergeben und die WM_PAINT Nachricht dann manuell gepostet.<br />
(HWND s-&gt;p = CView::GetSafeHwnd())</p>
<pre><code class="language-cpp">CFlitzDoc* pDoc = (CFlitzDoc*) s-&gt;p;
CFlitzView* pView = (CFlitzView*)CWnd::FromHandle(s-&gt;hw);
pView-&gt;InvalidateRect(NULL,FALSE);
::PostMessage(s-&gt;hw,WM_PAINT,NULL,NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/394679</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/394679</guid><dc:creator><![CDATA[Flo347]]></dc:creator><pubDate>Sat, 15 Nov 2003 15:22:07 GMT</pubDate></item><item><title><![CDATA[Reply to MultiThread-UpdateAllViews()-Konstruktion verhindert Aktualisierung der Toolbar on Sat, 15 Nov 2003 21:52:36 GMT]]></title><description><![CDATA[<p>a) WM_PAINT sollte niemals direkt an ein Fenster geschickt werden. Invalidate reicht da aus.<br />
b) MFC ist sehr threading-Unfreundlich. Wenn irgend möglich, solltest du:<br />
- auf UI-Threads (wenn überhaupt) auf Dialoge u.ä beschränken<br />
- das ganze Doc/View - Handling der Views im Main Thread lassen<br />
erspart 'ne Menge Kopfschmerzen.</p>
<p>Versteh ich deine Thread-Architektur richtig:<br />
Der Main Thread startet einen Worker Thread, und geht in eine lokale message Loop, die außerdem auf ein Event wartet. Das Event scheint nur ein UpdateAllViews auszulösen.</p>
<p>Warum sparst du dir nicht die lokale Message Loop, und löst das UpdateAlViews über ein MainFrame-&gt;PostMessage(&lt;application defined message&gt;) aus?<br />
Wäre m.E. sauberer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/394911</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/394911</guid><dc:creator><![CDATA[peterchen]]></dc:creator><pubDate>Sat, 15 Nov 2003 21:52:36 GMT</pubDate></item></channel></rss>