<div class="post-text" style="margin:0px 5px 5px 0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;width:660px;line-height:18px;font-family:Arial,&#39;Liberation Sans&#39;,&#39;DejaVu Sans&#39;,sans-serif;text-align:left">
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word"><span style="background-color:rgb(255,255,255)">Dear all,</span></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word">
<span style="background-color:rgb(255,255,255)">I have a MFC app where I am calling vtkMFC.dll from the exe. There I am getting a debug assertion as below in afxwin1.inl.</span></p><blockquote style="margin:0px 0px 10px;padding:10px 10px 1px;border:0px;font-size:14px;vertical-align:baseline;quotes:none">
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word"><span style="background-color:rgb(255,255,255)">{ ASSERT(afxCurrentInstanceHandle != NULL);</span></p>
</blockquote><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word"><span style="background-color:rgb(255,255,255)">I tried to use <code style="margin:0px;padding:1px 5px;border:0px;font-size:14px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,serif">AfxSetResourceHandle(GetModuleHandle(&quot;vtkMFC.dll&quot;))</code> but still getting the same error. I am using VS 2008.Below is my code:</span></p>
<blockquote style="margin:0px 0px 10px;padding:10px 10px 1px;border:0px;font-size:14px;vertical-align:baseline;quotes:none"><pre class="lang-c prettyprint" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:14px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,serif;overflow:auto;width:auto;max-height:600px">
<code style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,serif"><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><span style="background-color:rgb(255,255,255)">    AFX_MANAGE_STATE</span></span><span style="background-color:rgb(255,255,255)"><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">AfxGetStaticModuleState</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">())</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CWaitCursor</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> WC</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">;</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="com" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">// sometimes takes a while to start</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CCCADApp</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">*</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">app </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CCCADApp</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">*)</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">AfxGetApp</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">();</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CFrameWnd</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">*</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">frame </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> app</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">pVtkTemplate</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CreateNewFrame</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">this</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> NULL </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">);</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="com" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">// first init creates the view </span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    app</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">pVtkTemplate</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">InitialUpdateFrame</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> frame</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">this</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> FALSE</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">);</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CvtkMDIView</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">*</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">dynamic_cast</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">&lt;</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CvtkMDIView</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">*&gt;(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">frame</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">GetActiveView</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">());</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> <br>
    </span><span class="com" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">//</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="com" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">// automatic correction - try to load initial field if solution is not available</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">if</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">run</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">GetStatus</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">()==</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">CDawesRun</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">::</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">NOTRUN</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> options</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">=</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">VTKInitialField</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">|</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">VTKGrid</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">|(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">options </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">&amp;</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">VTKView2D</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">);</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">if</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> view</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">setData</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">run</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">options</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">variable</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">);</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="com" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">// set data</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    </span><span class="com" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">// show the view and frame</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
    app</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">pVtkTemplate</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">-&gt;</span><span class="typ" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">InitialUpdateFrame</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> frame</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">this</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"> TRUE</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline">);</span></span><span class="pln" style="background-color:rgb(255,255,255);margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline"><br>
</span></code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word"><span style="background-color:rgb(255,255,255)"> Please help me.</span></p></blockquote>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:14px;vertical-align:baseline;clear:both;word-wrap:break-word"><span style="background-color:rgb(255,255,255)">Thanks.</span></p></div><br class="Apple-interchange-newline">