<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=4>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=4>I use vtk and MFC to develop an application. 
Rendering a volume in Ondraw() method is very time consuming. So I intend to 
create a thread in Ondraw() method to render it. The code is as 
below:</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>//use thread to visualize<BR>UINT Rendering(LPVOID 
pParam)<BR>{<BR>&nbsp; CView* pView = (CView*)pParam;</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>&nbsp; if ( !pView-&gt;iren-&gt;GetInitialized() 
)<BR>&nbsp; {</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>&nbsp;&nbsp;&nbsp; CRect 
rect;<BR>&nbsp;&nbsp;&nbsp; pView-&gt;GetClientRect(&amp;rect);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>&nbsp;&nbsp;&nbsp; 
pView-&gt;iren-&gt;Initialize();<BR>&nbsp;&nbsp;&nbsp; 
pView-&gt;renWin-&gt;SetSize(rect.right-rect.left,rect.bottom-rect.top);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>&nbsp; }</FONT></DIV><FONT face=Arial size=4>
<DIV><BR>&nbsp;&nbsp;&nbsp; pView-&gt;renWin-&gt;Render();<BR>&nbsp;return 
0;</DIV>
<DIV><BR>}</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>CView::Ondraw()</FONT></DIV>
<DIV><FONT face=Arial size=4>{</FONT></DIV>
<DIV><FONT face=Arial size=4>....</FONT></DIV>
<DIV><FONT face=Arial size=4>&nbsp; AfxBeginThread(Rendering, 
this);</FONT></DIV>
<DIV><FONT face=Arial size=4>...<BR><BR>}</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>However the error is :choose pixel format is 
error</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>Anybody help me?</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=4></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=4>Yixun Liu</FONT></DIV></BODY></HTML>