My ActiveX control won't show in MFC App

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>
 
D

David Lowndes

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
 
G

Guest

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?
 
M

Marcus Heege

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top