<div>Hi folks,</div>
<div> </div>
<div>I&#39;m testing callback function in VTK textbook as follows,</div>
<div> </div>
<div>void MyClass::KeypressCallbackFunction (vtkObject* obj, unsigned long, void*, void*)<br>{<br> cout &lt;&lt; &quot;modified callback&quot; &lt;&lt; endl; <br> vtkRenderWindowInteractor *iren = static_cast&lt;vtkRenderWindowInteractor*&gt;(obj); <br>
 cout &lt;&lt; &quot;Pressed: &quot; &lt;&lt; iren-&gt;GetKeySym() &lt;&lt; endl;</div>
<div> vtkRenderer *ren = reinterpret_cast&lt;vtkRenderer*&gt;(obj);</div>
<div>  cout &lt;&lt; ren-&gt;GetActiveCamera()-&gt;GetPosition()[0] &lt;&lt; &quot; &quot;<br>   &lt;&lt; ren-&gt;GetActiveCamera()-&gt;GetPosition()[1] &lt;&lt; &quot; &quot;<br>   &lt;&lt; ren-&gt;GetActiveCamera()-&gt;GetPosition()[2] &lt;&lt; &quot;\n&quot;;</div>

<div>}</div>
<div> </div>
<div>But, I got an error message at second and third cout function.</div>
<div> </div>
<div>---</div>
<div>Unhandled exception in MyClass.exe: 0xC0000005: Access Violation.</div>
<div>---</div>
<div> </div>
<div>How to break the error?</div>
<div> </div>
<div>regards,</div>
<div>JY</div>