<?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[Zugriff auf document aus workthread]]></title><description><![CDATA[<p>Hallo wie kann ich aus einem Thread auf das aktuelle Document zugreifen?</p>
<pre><code class="language-cpp">UINT CSipromTApp::MyDisplayThread(LPVOID pParam) 
{ 
    CSipromTDoc* pDoc = (CSipromTDoc*)(((CMainFrame*)AfxGetMainWnd())-&gt;GetActiveDocument()); 
    ASSERT(pDoc); 

    if(pDoc-&gt;GetDeviceType() == 1) 
    {     
        MyTH100Com-&gt;MeasurementCom(); 
    } 
}
</code></pre>
<p>An der Stelle GetActiveDocument bekomme ich eine Zugriffsverletzung.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/189158/zugriff-auf-document-aus-workthread</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 22:39:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/189158.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Aug 2007 08:59:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zugriff auf document aus workthread on Thu, 09 Aug 2007 08:59:37 GMT]]></title><description><![CDATA[<p>Hallo wie kann ich aus einem Thread auf das aktuelle Document zugreifen?</p>
<pre><code class="language-cpp">UINT CSipromTApp::MyDisplayThread(LPVOID pParam) 
{ 
    CSipromTDoc* pDoc = (CSipromTDoc*)(((CMainFrame*)AfxGetMainWnd())-&gt;GetActiveDocument()); 
    ASSERT(pDoc); 

    if(pDoc-&gt;GetDeviceType() == 1) 
    {     
        MyTH100Com-&gt;MeasurementCom(); 
    } 
}
</code></pre>
<p>An der Stelle GetActiveDocument bekomme ich eine Zugriffsverletzung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341312</guid><dc:creator><![CDATA[maRKus23]]></dc:creator><pubDate>Thu, 09 Aug 2007 08:59:37 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff auf document aus workthread on Thu, 09 Aug 2007 10:32:52 GMT]]></title><description><![CDATA[<p>Das Problem hatte ich auch schon mal. Probiers mal so:</p>
<pre><code class="language-cpp">CFrameWnd* pMain = (CFrameWnd*)AfxGetMainWnd();
CSipromTDoc* pDoc = (CSipromTDoc*)pMain-&gt;GetActiveDocument( );
</code></pre>
<p>Bei mir gings damit. Ich hab da noch was gefunden. Schau mal <a href="http://www.codeguru.com/forum/showthread.php?t=282338&amp;goto=nextoldest" rel="nofollow">hier</a>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1341385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1341385</guid><dc:creator><![CDATA[AndyDD]]></dc:creator><pubDate>Thu, 09 Aug 2007 10:32:52 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff auf document aus workthread on Fri, 10 Aug 2007 11:39:00 GMT]]></title><description><![CDATA[<p>Wenn man die Methode AfxGetMainWnd aus einem Thread ausrufen will, muss man aber ein wenig aufpassen afaik.</p>
<blockquote>
<p>MSDN:<br />
AfxGetMainWnd is called from the application's primary thread, it returns the application's main window according to the above rules. If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call.</p>
</blockquote>
<p>Kannst Du nicht einfach einen Pointer an deinen Thread übergeben, der auf die entsprechenden Daten verweist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1342155</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1342155</guid><dc:creator><![CDATA[Mr.Yellow]]></dc:creator><pubDate>Fri, 10 Aug 2007 11:39:00 GMT</pubDate></item><item><title><![CDATA[Reply to Zugriff auf document aus workthread on Fri, 10 Aug 2007 12:14:41 GMT]]></title><description><![CDATA[<p>Mr.Yellow schrieb:</p>
<blockquote>
<p>Wenn man die Methode AfxGetMainWnd aus einem Thread ausrufen will, muss man aber ein wenig aufpassen afaik.</p>
</blockquote>
<p>Du hast natürlich Recht. Da ist ja Threadfunktion, hatte ich irgendwie überlesen. Eingentlich kann man, wie du schon sagst, das außerhalb des Threads durchführen und diesen Pointer als Parameter übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1342172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1342172</guid><dc:creator><![CDATA[AndyDD]]></dc:creator><pubDate>Fri, 10 Aug 2007 12:14:41 GMT</pubDate></item></channel></rss>