My ActiveX control won't show in MFC App

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Platform: VS.Net, Unmanaged MFC C++ Application

I used the "Add Class -> MFC -> MFC Class From ActiveX Control" wizard to
generate a class for my charting control. Now I'm attempting to add the
control to my MFC application.

I can instantiate the control but it won't show in the CView window. I know
the control is instantiated because I can call an "export to file" function
and it does export the chart to a file.

Any ideas? Am I missing a step?

Code to instantiate the control:
<codeSnippet>
if (m_AxisChart.Create(NULL, dwStyle, CRect(0, 0, 100, 100), this,
ID_AXISCHART) == 0)
{
AfxMessageBox("Unable to create Chart control!");
return -1;
}
</codeSnippet>
 
I can instantiate the control but it won't show in the CView window.
if (m_AxisChart.Create(NULL, dwStyle, CRect(0, 0, 100, 100), this,

Does dwStyle include WS_VISIBLE ?

Dave
 
Ok, we've worked out the problem. The ActiveX control is windowless and
apparently the CView class will instantiate but not display any windowless
ActiveX controls.

Can anyone suggest how to get around this?
 
How about creating it via CoCreateInstance, like any other COM object?

Since it is not visible, there is probably no need to do the control
specific things. The only thing I see that could require some extra work is
event registration.

Marcus
 
Back
Top