CWinFormsControl error

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p align=left><font face=Arial size=2></font> 
<table cellspacing=0 cellpadding=0 width="90%" align=left>
<tbody>
<tr>
<td class=txt4lt style="word-wrap:break-word" width=625><span>
<p align=left>Hi I created an MFC Extended DLL in VS 2005 where in I am showing .NET ReportViewer control in a Dialog Box.
<p align=left>And I have a fuction called ShowReportDlg() which is exported, and on calling this function the Dialog with the report viewer control is shown.
<p align=left> 
<p dir=ltr style="margin-right:0px" align=left>The function ShowReportDlg() works fine if I am calling it from MDI or SDI MFC application. But it terminates the application due to null pointer exception when I am calling it form other Dialog based MFC application.
<p align=left> 
<p align=left>It breaks at the following function.
<p align=left>  <font color="#0000ff
<font face=Courier>template</font></font><font face=Courier><<font color="#0000ff class</font> TManagedControl> </font><font color="#0000ff
<font face=Courier>inline</font></font><font face=Courier> HWND CWinFormsControl<TManagedControl>::GetControlHandle() <font color="#0000ff const </font></font>
<font face=Courier>{</font>
<blockquote dir=ltr style="margin-right:0px
<font face=Courier><font color="#0000ff return</font> <font color="#0000ff reinterpret_cast</font><HWND>(<font color="#0000ff static_cast</font></font><font face=Courier><INT_PTR>(GetControl()->Handle));</font> </blockquote>
<font face=Courier>} </font>
<font face=Courier><font face=Arial> because</font> </font> <font color="#0000ff
<font face=Courier>template</font></font><font face=Courier><<font color="#0000ff class</font> TManagedControl> </font><font color="#0000ff
<font face=Courier>inline</font></font><font face=Courier> TManagedControl^ CWinFormsControl<TManagedControl>::GetControl() <font color="#0000ff const </font></font>
<p align=left><font color="#000000 is returning a NULL pointer.</font>
 
<p align=left>Could anyone help me to fix this issue or else tell me what is happening behind the code?

<p align=left>Thanks </td></tr></tbody></table>

View the full article
 
Back
Top